Example #1
0
        /*
         * System.Net.Mail.MailAddress NewMail = new MailAddress("netwrix.r" + (char)0x26 + "*****@*****.**", "netwrix.r" + (char)0x26 + "d.spb.qc.at.msi", System.Text.Encoding.UTF8);
         */

        public virtual void SendMessage(IMailSettings settings)
        {
            var message = new MailMessage(
                settings.From,
                settings.To,
                settings.Subject,
                settings.Body)
            {
                IsBodyHtml = settings.IsBodyHtml
            };

            foreach (var smtpServer in settings.SmtpServers)
            {
                var client = new SmtpClient(smtpServer)
                {
                    UseDefaultCredentials = true
                };
                try {
                    client.Send(message);
                }
                catch (Exception ex) {
                    // TODO: AOP
                    Trace.TraceError("SendMessage(IMailSettings settings)");
                    // ??
                    Trace.TraceError(ex.Message);
                }
            }
        }
Example #2
0
 public MailController(
     IMailService mailService,
     IMailSettings mailSettings,
     ILogger <MailController> logger)
 {
     _mailService  = mailService;
     _mailSettings = mailSettings;
     _logger       = logger;
 }
Example #3
0
 public void Send(MailMessage mailMessage, IMailSettings mailSettings)
 {
     try
     {
         using (var client = new SmtpClient(mailSettings.SmtpServer, mailSettings.SmtpPort))
         {
             client.UseDefaultCredentials = false;
             client.Credentials           = new NetworkCredential(mailSettings.Username, mailSettings.Password);
             client.EnableSsl             = true;
             client.Timeout = 10000;
             client.Send(mailMessage);
         }
     }
     catch (Exception ex)
     {
         Logger.Exception(ex);
     }
 }
Example #4
0
 /*
 System.Net.Mail.MailAddress NewMail = new MailAddress("netwrix.r" + (char)0x26 + "*****@*****.**", "netwrix.r" + (char)0x26 + "d.spb.qc.at.msi", System.Text.Encoding.UTF8); 
 */
 
 public virtual void SendMessage(IMailSettings settings)
 {
     var message = new MailMessage(
         settings.From,
         settings.To,
         settings.Subject,
         settings.Body) {
         IsBodyHtml = settings.IsBodyHtml
     };
     
     foreach (var smtpServer in settings.SmtpServers) {
         var client = new SmtpClient(smtpServer) {UseDefaultCredentials = true};
         try {
             client.Send(message);
         }
         catch (Exception ex) {
             // TODO: AOP
             Trace.TraceError("SendMessage(IMailSettings settings)");
             // ??
             Trace.TraceError(ex.Message);
         }
     }
 }
Example #5
0
 public MailNotifier(IMailSettings mailSettings)
 {
     _mailSettings = mailSettings;
 }
Example #6
0
 public SendMailService(IMailSettings settings)
 {
     this.settings = settings;
 }
Example #7
0
 public MailSettingsBO()
 {
     mailsettingDAO = new MailSettingsDAO();
 }
 public MailService(IMailSettings mailSettings)
 {
     _mailSettings = mailSettings;
 }
Example #9
0
 public SystemNetMailMailer(IMailSettings settings)
 {
     this.settings = settings;
 }
 public SystemNetMailMailer(IMailSettings settings)
 {
     this.settings = settings;
 }
 public SendMailService(IMailSettings settings, IRepository<MailTemplate> repository)
 {
     this.settings = settings;
     this.repository = repository;
 }
Example #12
0
 public void Send(MailMessage mailMessage, IMailSettings mailSettings)
 {
     MailMessage = mailMessage;
 }
Example #13
0
 public EmailService(IMailSettings mailConfig)
 {
     _mailConfig = mailConfig ?? throw new ArgumentNullException(nameof(mailConfig));
 }
Example #14
0
 public Mail(IMailSender mailSender, IMailSettings mailSettings)
 {
     _mailSender   = mailSender;
     _mailSettings = mailSettings;
 }