1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-06 13:38:13 -05:00

smtp fixes

This commit is contained in:
Kyle Spearrin 2017-08-21 22:36:31 -04:00
parent 15e69a529e
commit 1ab815dbb8
2 changed files with 38 additions and 39 deletions

View File

@ -22,8 +22,7 @@ namespace Bit.Core.Services
public Task SendEmailAsync(Models.Mail.MailMessage message) public Task SendEmailAsync(Models.Mail.MailMessage message)
{ {
using(var client = new SmtpClient(_globalSettings.Mail.Smtp.Host, _globalSettings.Mail.Smtp.Port)) var client = new SmtpClient(_globalSettings.Mail.Smtp.Host, _globalSettings.Mail.Smtp.Port);
{
client.UseDefaultCredentials = false; client.UseDefaultCredentials = false;
client.EnableSsl = _globalSettings.Mail.Smtp.Ssl; client.EnableSsl = _globalSettings.Mail.Smtp.Ssl;
client.DeliveryMethod = SmtpDeliveryMethod.Network; client.DeliveryMethod = SmtpDeliveryMethod.Network;
@ -57,11 +56,11 @@ namespace Bit.Core.Services
client.SendCompleted += (s, e) => client.SendCompleted += (s, e) =>
{ {
smtpMessage.Dispose(); smtpMessage.Dispose();
client.Dispose();
}; };
client.SendAsync(smtpMessage, null); client.SendAsync(smtpMessage, null);
return Task.FromResult(0); return Task.FromResult(0);
} }
} }
}
} }

View File

@ -397,7 +397,7 @@ globalSettings__mail__smtp__host=REPLACE
globalSettings__mail__smtp__username=REPLACE globalSettings__mail__smtp__username=REPLACE
globalSettings__mail__smtp__password=REPLACE globalSettings__mail__smtp__password=REPLACE
globalSettings__mail__smtp__ssl=true globalSettings__mail__smtp__ssl=true
globalSettings__mail__smtp__port=465"); globalSettings__mail__smtp__port=587");
if(!_push) if(!_push)
{ {