public static void SendMail(EmailSetting emailSetting, string Subject, string body) { MailMessage message; SmtpClient client; try { message = new System.Net.Mail.MailMessage( emailSetting.User, emailSetting.MailTo, Subject, body); message.From = new MailAddress(emailSetting.User, "From"); client = new SmtpClient(emailSetting.SMTPServer, emailSetting.Port); client.Credentials = new NetworkCredential(emailSetting.User, emailSetting.GetPassword()); client.EnableSsl = emailSetting.EnableSsl; client.DeliveryMethod = SmtpDeliveryMethod.Network; message.BodyEncoding = System.Text.Encoding.UTF8; message.IsBodyHtml = true; client.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback); client.SendAsync(message, client); } catch (Exception ex) { Logger logger = LogManager.GetCurrentClassLogger(); logger.Error(ex.Message + ". " + ex.InnerException.Message); } }
public SA1CConfig() { basesConfig = new List <BaseConfig>(); Version = "1"; CheckUpdate = true; Email = new EmailSetting(); HostSetting = new ServiceHostSetting(); DisableUser = TypeKillUsers.None; DinamycUpdateDB = true; NumOperationRepeat = 5; NumExchangeRepeat = 0; }