This commit is contained in:
2023-02-22 17:27:29 +00:00
parent 2bd20a0203
commit 115af150db

View File

@@ -22,6 +22,7 @@ namespace Sockeye.Util
public async Task SendEmailAsync(string email, string subject, string body, Sockeye.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":
@@ -32,7 +33,7 @@ namespace Sockeye.Util
case "techworks@shaw.ca":
break;
default:
System.Diagnostics.Debug.WriteLine($"DANGER: about to email someone {email} outside our test network");
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;
@@ -42,7 +43,7 @@ namespace Sockeye.Util
{
var message = new MimeMessage();
message.From.Add(new MailboxAddress(smtpSettings.NotifyFromAddress, smtpSettings.NotifyFromAddress));
message.To.Add(MailboxAddress.Parse(email));
message.To.Add(MailboxAddress.Parse(email));
message.Subject = subject;
if (!string.IsNullOrWhiteSpace(attachPDFPath))
@@ -89,6 +90,8 @@ namespace Sockeye.Util
await client.AuthenticateAsync(smtpSettings.SmtpAccount, smtpSettings.SmtpPassword);
//NOTE: this is the one and only place in all of sockeye/ayanova that will send an email
//everything else is upstream caller
await client.SendAsync(message);
await client.DisconnectAsync(true);
DisposeStreamsInMimeMessage(message);