From a34cfe62e3415e400c60c230a5fe3f5d9c62155d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 22 Feb 2023 17:27:29 +0000 Subject: [PATCH] --- server/AyaNova/util/Mailer.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/server/AyaNova/util/Mailer.cs b/server/AyaNova/util/Mailer.cs index 2fd8fea2..b9f5d31e 100644 --- a/server/AyaNova/util/Mailer.cs +++ b/server/AyaNova/util/Mailer.cs @@ -21,6 +21,24 @@ namespace AyaNova.Util public async Task SendEmailAsync(string email, string subject, string body, AyaNova.Models.GlobalOpsNotificationSettings smtpSettings, string attachPDFPath = null, string forceFileName = null, string htmlBody = null) { +#if (DEBUG) + //SAFETY BREAK FOR TESTING IN HOUSE + switch (email) + { + case "support@ayanova.com": + case "johncrdnl@gmail.com": + case "gzmailadmin@gmail.com": + case "sales@ayanova.com": + case "support@onayanova.com": + case "techworks@shaw.ca": + break; + default: + System.Diagnostics.Debug.WriteLine($"DANGER: in DEBUG mode but about to email someone {email} outside our test network"); + //DANGER: about to email someone outside our test network + System.Diagnostics.Debugger.Break(); + break; + } +#endif try { var message = new MimeMessage(); @@ -72,6 +90,8 @@ namespace AyaNova.Util await client.AuthenticateAsync(smtpSettings.SmtpAccount, smtpSettings.SmtpPassword); + //this is the one and only place that email is sent from ultimately + //everything else is upstream await client.SendAsync(message); await client.DisconnectAsync(true); DisposeStreamsInMimeMessage(message);