From 9a4386e28efa449d53e7d64bc994c867959aef3d Mon Sep 17 00:00:00 2001 From: Javier Pastor Date: Sat, 16 Nov 2019 22:05:16 +0100 Subject: [PATCH] Update GenericEmailProvider.cs Add the two checks in when inside catch. --- src/Ombi.Notifications/GenericEmailProvider.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Ombi.Notifications/GenericEmailProvider.cs b/src/Ombi.Notifications/GenericEmailProvider.cs index 49bdb1fa9..90033e385 100644 --- a/src/Ombi.Notifications/GenericEmailProvider.cs +++ b/src/Ombi.Notifications/GenericEmailProvider.cs @@ -100,16 +100,9 @@ namespace Ombi.Notifications { 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); - } - else - { - throw; - } + _log.LogError("Could not send email '{0}', address <{1}> does not exist.", message.Subject, model.To); } await client.DisconnectAsync(true); }