Esempio n. 1
0
        public async Task Execute(AuthMessageSenderOptions options, string subject, string message, string from, string fromName, string to)
        {
            using (SmtpClient smtp = new SmtpClient(options.SMTPServer)
            {
                EnableSsl = true,
                Port = options.SMTPPort,
                Credentials = new NetworkCredential(options.UserName, options.Password)
            }
                   )
            {
                MailMessage mail = new MailMessage()
                {
                    //From = new MailAddress("*****@*****.**", "Wacomi")
                    From = new MailAddress(from, fromName)
                };
                mail.To.Add(new MailAddress(to));

                mail.Subject    = subject;
                mail.Body       = message;
                mail.IsBodyHtml = true;
                mail.Priority   = MailPriority.Normal;

                await smtp.SendMailAsync(mail);
            }
        }
Esempio n. 2
0
 public EmailSender(IOptions <AuthMessageSenderOptions> optionsAccessor)
 {
     Options = optionsAccessor.Value;
 }
Esempio n. 3
0
 public MailGunManager(IOptions <AuthMessageSenderOptions> optionsAccessor, ILogger <MailGunManager> logger)
 {
     this._options = optionsAccessor.Value;
     this._logger  = logger;
 }