Asynchronously send mails.

This commit is contained in:
Michael 2017-04-04 19:20:31 -04:00
parent c40b616265
commit 39a0312f7f

View file

@ -38,7 +38,9 @@ public Task SendAsync(IdentityMessage message)
<p>" + CommonMark.CommonMarkConverter.Convert(message.Body) + "</p>";
sMsg.Subject = $"[{siteConfig.SiteName}] " + message.Subject;
sMsg.IsBodyHtml = true;
smtp.Send(sMsg);
smtp.SendAsync(sMsg, null));
var db = new ApplicationDbContext();
db.AuditLogs.Add(new AuditLog("system", AuditLogLevel.Admin, $"Email sent successfully.<br/><br/><strong>To:</strong> {sMsg.To}<br/><strong>Subject:</strong><br/>{sMsg.Subject}"));
}
catch (Exception ex)
{
@ -50,6 +52,8 @@ public Task SendAsync(IdentityMessage message)
}
return Task.FromResult(0);
}
}
public class SmsService : IIdentityMessageService