Example #1
0
        public static void SendEmail(string to, string subject, string body, SmtpInfo smtpInfo)
        {
            try
            {
                using (var client = new SmtpClient(smtpInfo.Host, smtpInfo.Port))
                {
                    client.UseDefaultCredentials = string.IsNullOrWhiteSpace(smtpInfo.UserName);
                    client.EnableSsl = smtpInfo.EnableSsl;

                    if (!string.IsNullOrWhiteSpace(smtpInfo.UserName))
                    {
                        client.Credentials = new NetworkCredential(smtpInfo.UserName, smtpInfo.Password);
                    }

                    var msg = new MailMessage("*****@*****.**", to, subject, body);
                    msg.IsBodyHtml = true;

                    client.Send(msg);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 public EagleConfigurationModel()
 {
     Directories = new ObservableCollection<PathInfo>();
     Emails = new ObservableCollection<string>();
     SmtpInfo = new SmtpInfo();
 }