|
|
|
@ -83,23 +83,6 @@ namespace NzbDrone.Core.Notifications.Email
|
|
|
|
|
return new ValidationResult(failures);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ValidationFailure Test(EmailSettings settings)
|
|
|
|
|
{
|
|
|
|
|
const string body = "Success! You have properly configured your email notification settings";
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SendEmail(settings, "Radarr - Test Notification", body);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.Error(ex, "Unable to send test email");
|
|
|
|
|
return new ValidationFailure("Server", "Unable to send test email");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SendEmail(EmailSettings settings, string subject, string body, bool htmlBody = false)
|
|
|
|
|
{
|
|
|
|
|
var email = new MimeMessage();
|
|
|
|
@ -129,13 +112,12 @@ namespace NzbDrone.Core.Notifications.Email
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.Debug("Finished sending email. Subject: {0}", email.Subject);
|
|
|
|
|
_logger.Debug("Finished sending email. Subject: {0}", subject);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Send(MimeMessage email, EmailSettings settings)
|
|
|
|
|
{
|
|
|
|
|
using (var client = new SmtpClient())
|
|
|
|
|
{
|
|
|
|
|
using var client = new SmtpClient();
|
|
|
|
|
client.Timeout = 10000;
|
|
|
|
|
|
|
|
|
|
var serverOption = SecureSocketOptions.Auto;
|
|
|
|
@ -175,6 +157,22 @@ namespace NzbDrone.Core.Notifications.Email
|
|
|
|
|
|
|
|
|
|
_logger.Debug("Disconnecting from mail server");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ValidationFailure Test(EmailSettings settings)
|
|
|
|
|
{
|
|
|
|
|
const string body = "Success! You have properly configured your email notification settings";
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SendEmail(settings, "Radarr - Test Notification", body);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.Error(ex, "Unable to send test email");
|
|
|
|
|
return new ValidationFailure("Server", "Unable to send test email");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MailboxAddress ParseAddress(string type, string address)
|
|
|
|
|