1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

force SecureSocketOptions.none if 25 w/ no ssl

This commit is contained in:
Kyle Spearrin 2019-03-19 00:47:07 -04:00
parent 01a293cf76
commit 625ed1a1ee

View File

@ -67,9 +67,17 @@ namespace Bit.Core.Services
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
}
if(!_globalSettings.Mail.Smtp.Ssl && _globalSettings.Mail.Smtp.Port == 25)
{
await client.ConnectAsync(_globalSettings.Mail.Smtp.Host, _globalSettings.Mail.Smtp.Port,
MailKit.Security.SecureSocketOptions.None);
}
else
{
var useSsl = _globalSettings.Mail.Smtp.Port == 587 && !_globalSettings.Mail.Smtp.SslOverride ?
false : _globalSettings.Mail.Smtp.Ssl;
await client.ConnectAsync(_globalSettings.Mail.Smtp.Host, _globalSettings.Mail.Smtp.Port, useSsl);
}
if(!string.IsNullOrWhiteSpace(_globalSettings.Mail.Smtp.Username) &&
!string.IsNullOrWhiteSpace(_globalSettings.Mail.Smtp.Password))