From 5ae3c4b1f74b9b18070e310d46a645b59dbb175a Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Tue, 21 Oct 2014 13:56:36 +0200 Subject: [PATCH] Fix for galloping exceptions on Sandbox --- Utility/Communications/CommsTransmitterMail.cs | 14 ++++++++++++-- Utility/ExceptionMail.cs | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Utility/Communications/CommsTransmitterMail.cs b/Utility/Communications/CommsTransmitterMail.cs index 94ddae2a..6fa428b4 100644 --- a/Utility/Communications/CommsTransmitterMail.cs +++ b/Utility/Communications/CommsTransmitterMail.cs @@ -30,8 +30,18 @@ namespace Swarmops.Utility.Communications // This is a rather simple mail (no images or stuff like that) - mail.From = new MailAddress(comm[CommRenderPart.SenderMail], comm[CommRenderPart.SenderName], Encoding.UTF8); - mail.To.Add(new MailAddress(person.Mail, person.Name)); + try + { + mail.From = new MailAddress(comm[CommRenderPart.SenderMail], comm[CommRenderPart.SenderName], Encoding.UTF8); + mail.To.Add(new MailAddress(person.Mail, person.Name)); + } + catch (ArgumentException e) + { + // Address failure -- either sender or recipient + + _cacheReloadTime = DateTime.MinValue; + throw new OutboundCommTransmitException("Cannot send mail to " + person.Mail, e); + } mail.Subject = comm[CommRenderPart.Subject]; mail.Body = comm[CommRenderPart.BodyText]; diff --git a/Utility/ExceptionMail.cs b/Utility/ExceptionMail.cs index 7ba41fe2..a0f82238 100644 --- a/Utility/ExceptionMail.cs +++ b/Utility/ExceptionMail.cs @@ -17,7 +17,7 @@ namespace Swarmops.Utility { try { - SwarmDb.GetDatabaseForWriting().CreateExceptionLogEntry(DateTime.Now, "ExceptionMail", e); + SwarmDb.GetDatabaseForWriting().CreateExceptionLogEntry(DateTime.UtcNow, "ExceptionMail", e); } catch {