Update GenericEmailProvider.cs

Add the two checks in when inside catch.
This commit is contained in:
Javier Pastor 2019-11-16 22:05:16 +01:00 committed by GitHub
commit 9a4386e28e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -100,16 +100,9 @@ namespace Ombi.Notifications
{ {
await client.SendAsync(message); await client.SendAsync(message);
} }
catch (MailKit.Net.Smtp.SmtpCommandException e) when (e.ErrorCode.Equals(MailKit.Net.Smtp.SmtpErrorCode.RecipientNotAccepted)) catch (MailKit.Net.Smtp.SmtpCommandException e) when (e.ErrorCode.Equals(MailKit.Net.Smtp.SmtpErrorCode.RecipientNotAccepted) && e.StatusCode.Equals(MailKit.Net.Smtp.SmtpStatusCode.MailboxUnavailable))
{ {
if (e.StatusCode.Equals(MailKit.Net.Smtp.SmtpStatusCode.MailboxUnavailable)) _log.LogError("Could not send email '{0}', address <{1}> does not exist.", message.Subject, model.To);
{
_log.LogError("Could not send email '{0}', address <{1}> does not exist.", message.Subject, model.To);
}
else
{
throw;
}
} }
await client.DisconnectAsync(true); await client.DisconnectAsync(true);
} }