public bool SendExceptionError(string message, params object[] args) { MailMessage mail = new MailMessage(); StringBuilder body = new StringBuilder(); body.Append("Here is the detail of the exception:\n\n"); body.Append(message + "\n\n"); mail.Body = body.ToString(); mail.Subject = "Application Exception Error"; mail.To.Add(_errorEmailSettings.To); ComplyToSmtp smtp = new ComplyToSmtp(_errorEmailSettings, _logger); var isSuccess = smtp.Send(mail); return(isSuccess); }
public async Task <bool> SendMailAsync(string mailAddress, string subject, string message) { MailMessage mail = new MailMessage(); bool isSuccess = false; mail.Body = message; mail.Subject = subject; mail.To.Add(mailAddress); if (!_emailSettings.Bcc.Equals(string.Empty)) { mail.Bcc.Add(_emailSettings.Bcc); } if (message.Contains("<") && message.Contains(">")) { mail.IsBodyHtml = true; } ComplyToSmtp smtp = new ComplyToSmtp(_emailSettings, _logger); isSuccess = await smtp.SendAsync(mail); return(isSuccess); }