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); }
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); }
public EmailSenderService(IOptions <EmailOptionsDTO> emailOptions) { _emailOptions = emailOptions.Value; }