Fixed: Email connection test reporting success incorrectly

Fixes #1524
pull/1284/merge
Mark McDowall 8 years ago
parent 25a3f83ebc
commit 2ece05cd1e

@ -45,25 +45,17 @@ namespace NzbDrone.Core.Notifications.Email
{ {
_logger.Error("Error sending email. Subject: {0}", email.Subject); _logger.Error("Error sending email. Subject: {0}", email.Subject);
_logger.Debug(ex, ex.Message); _logger.Debug(ex, ex.Message);
throw;
} }
} }
private void Send(MailMessage email, string server, int port, bool ssl, NetworkCredential credentials) private void Send(MailMessage email, string server, int port, bool ssl, NetworkCredential credentials)
{ {
try var smtp = new SmtpClient(server, port);
{ smtp.EnableSsl = ssl;
var smtp = new SmtpClient(server, port); smtp.Credentials = credentials;
smtp.EnableSsl = ssl;
smtp.Credentials = credentials;
smtp.Send(email);
}
catch (Exception ex) smtp.Send(email);
{
_logger.Error(ex, "There was an error sending an email.");
throw;
}
} }
public ValidationFailure Test(EmailSettings settings) public ValidationFailure Test(EmailSettings settings)

Loading…
Cancel
Save