Unverified Commit 102d6ea1 authored by Javier Pastor's avatar Javier Pastor Committed by GitHub

Update GenericEmailProvider.cs

Fix #3267
parent e08fbb52
......@@ -96,7 +96,21 @@ namespace Ombi.Notifications
client.Authenticate(settings.Username, settings.Password);
}
_log.LogDebug("sending message to {0} \r\n from: {1}\r\n Are we authenticated: {2}", message.To, message.From, client.IsAuthenticated);
await client.SendAsync(message);
try
{
await client.SendAsync(message);
}
catch (MailKit.Net.Smtp.SmtpCommandException e) when (e.ErrorCode.Equals(MailKit.Net.Smtp.SmtpErrorCode.RecipientNotAccepted))
{
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;
}
}
await client.DisconnectAsync(true);
}
}
......@@ -178,4 +192,4 @@ namespace Ombi.Notifications
}
}
}
}
\ No newline at end of file
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment