Use SSL instead of TLS when sending mail

This commit is contained in:
Michael 2017-04-04 19:01:14 -04:00
parent 303ef44a18
commit c40b616265

View file

@ -25,6 +25,8 @@ public Task SendAsync(IdentityMessage message)
var siteConfig = new ApplicationDbContext().Configs.FirstOrDefault(); var siteConfig = new ApplicationDbContext().Configs.FirstOrDefault();
var smtp = new SmtpClient(siteConfig.SMTPServer, siteConfig.SMTPPort); var smtp = new SmtpClient(siteConfig.SMTPServer, siteConfig.SMTPPort);
if (siteConfig.UseTLSEncryption)
smtp.EnableSsl = true; //This is misleading... We want TLS but all we have is SSL. Oh well.
smtp.UseDefaultCredentials = false; smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential(siteConfig.SMTPUsername, siteConfig.SMTPPassword); smtp.Credentials = new NetworkCredential(siteConfig.SMTPUsername, siteConfig.SMTPPassword);
var sMsg = new MailMessage(siteConfig.SMTPReturnAddress, message.Destination); var sMsg = new MailMessage(siteConfig.SMTPReturnAddress, message.Destination);