This commit is contained in:
2023-02-22 17:27:29 +00:00
parent 6cce89dbf4
commit a34cfe62e3

View File

@@ -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);