crash on failure

This commit is contained in:
Michael 2017-05-18 13:09:52 -04:00
parent 0d73c49fed
commit e19487b1a1

View file

@ -5,6 +5,7 @@
using System.Net; using System.Net;
using System.Net.Mail; using System.Net.Mail;
using System.Security.Claims; using System.Security.Claims;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web; using System.Web;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
@ -42,6 +43,22 @@ public Task SendAsync(IdentityMessage msg)
}; };
var result = reachmail.Easysmtp.Post(request); 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<DeliveryResponse>(result); return Task.FromResult<DeliveryResponse>(result);
} }