From e19487b1a1c381166b5defb8224fa05a6d93d986 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 18 May 2017 13:09:52 -0400 Subject: [PATCH] crash on failure --- Project-Unite/App_Start/IdentityConfig.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Project-Unite/App_Start/IdentityConfig.cs b/Project-Unite/App_Start/IdentityConfig.cs index dc36eb3..8788e97 100644 --- a/Project-Unite/App_Start/IdentityConfig.cs +++ b/Project-Unite/App_Start/IdentityConfig.cs @@ -5,6 +5,7 @@ using System.Net; using System.Net.Mail; using System.Security.Claims; +using System.Text; using System.Threading.Tasks; using System.Web; using Microsoft.AspNet.Identity; @@ -42,6 +43,22 @@ public Task SendAsync(IdentityMessage msg) }; var result = reachmail.Easysmtp.Post(request); + if (result.Failures) + { + var sb = new StringBuilder(); + sb.AppendLine("A fatal exception has occurred in the Unite mail backend."); + sb.AppendLine(); + sb.AppendLine("Basically, we couldn't send messages to the following addresses: "); + + foreach(var addr in result.FailedAddresses) + { + sb.AppendLine(" - " + addr.Email); + sb.AppendLine(" - Reason: " + addr.Reason); + } + sb.AppendLine("FUCKING CONTACT MICHAEL. NOW."); + string exc = sb.ToString(); + throw new Exception(exc); + } return Task.FromResult(result); }