Exemplo n.º 1
0
        public async Task Send(string emailAddress, string body, EmailOptionsDTO options)
        {
            var client = new SmtpClient();

            client.Host        = options.Host;
            client.Credentials = new NetworkCredential(options.ApiKey, options.ApiKeySecret);
            client.Port        = options.Port;

            var message = new MailMessage(options.SenderEmail, emailAddress);

            message.Body       = body;
            message.IsBodyHtml = true;

            await client.SendMailAsync(message);
        }
Exemplo n.º 2
0
        public async Task SendAsync(string emailTo, string body, string subject, EmailOptionsDTO options)
        {
            var client = new SmtpClient(options.Host, options.Port)
            {
                Credentials = new NetworkCredential(options.ApiKey, options.ApiKeySecret)
            };

            var message = new MailMessage(options.SenderEmail, emailTo)
            {
                Body       = body,
                IsBodyHtml = true,
                Subject    = subject
            };

            await client.SendMailAsync(message);
        }
Exemplo n.º 3
0
 public EmailSenderService(IOptions <EmailOptionsDTO> emailOptions)
 {
     _emailOptions = emailOptions.Value;
 }