From a9e8acf24be3c7df92810d0389ada81beca9cbf1 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 21 Nov 2022 00:53:58 +0000 Subject: [PATCH] --- devdocs/todo.txt | 2 +- .../AyaNova/Controllers/NotifyController.cs | 6 ++--- .../models/GlobalOpsNotificationSettings.cs | 22 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 98663127..63379256 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -1,2 +1,2 @@ todo: clean up solutions.txt and research.txt and move into a consolidated coding focused how-to.md doc - +todo: test regular notification after case 4310 isn't broken by changes to mail delivery system diff --git a/server/AyaNova/Controllers/NotifyController.cs b/server/AyaNova/Controllers/NotifyController.cs index 0c7f8b07..cc765a41 100644 --- a/server/AyaNova/Controllers/NotifyController.cs +++ b/server/AyaNova/Controllers/NotifyController.cs @@ -233,7 +233,7 @@ namespace AyaNova.Api.Controllers /// Send direct SMTP message notification so single object / address /// Note: adds to queue, not instantly sent /// - /// NoContent on success or error + /// Accepted on success or error [HttpPost("direct-smtp")] public async Task SendNotifySmtpDirectMessage([FromBody] NotifyDirectSMTP notifyDirectSMTP) { @@ -287,7 +287,7 @@ namespace AyaNova.Api.Controllers IMailer m = AyaNova.Util.ServiceProviderProvider.Mailer; try { - await m.SendEmailAsync(notifyDirectSMTP.ToAddress, "Test from Notification system", "This is a test to confirm notification system is working", ServerGlobalOpsSettingsCache.Notify); + await m.SendEmailAsync(notifyDirectSMTP.ToAddress, notifyDirectSMTP.Subject, notifyDirectSMTP.TextBody, ServerGlobalOpsSettingsCache.Notify,null,null,notifyDirectSMTP.HTMLBody); } catch (Exception ex) { @@ -295,7 +295,7 @@ namespace AyaNova.Api.Controllers return StatusCode(500, new ApiErrorResponse(ApiErrorCode.API_SERVER_ERROR, null, ExceptionUtil.ExtractAllExceptionMessages(ex))); } - return NoContent(); + return Accepted(); } public class NotifyDirectSMTP diff --git a/server/AyaNova/models/GlobalOpsNotificationSettings.cs b/server/AyaNova/models/GlobalOpsNotificationSettings.cs index 576355f7..87a08e4d 100644 --- a/server/AyaNova/models/GlobalOpsNotificationSettings.cs +++ b/server/AyaNova/models/GlobalOpsNotificationSettings.cs @@ -21,16 +21,16 @@ namespace AyaNova.Models SmtpDeliveryActive = true; Id = 1; - // #if (DEBUG) - // SmtpDeliveryActive = true; - // SmtpServerAddress = "mail.ayanova.com"; - // SmtpAccount = "support@ayanova.com"; - // SmtpPassword = "e527b6c5a00c27bb61ca694b3de0ee178cbe3f1541a772774762ed48e9caf5ce"; - // ConnectionSecurity = NotifyMailSecurity.StartTls; - // SmtpServerPort = 465; - // NotifyFromAddress = "support@ayanova.com"; - // AyaNovaServerURL="http://localhost:8080"; - // #else +#if (DEBUG) + SmtpDeliveryActive = true; + SmtpServerAddress = "smtp.fastmail.com"; + SmtpAccount = "support@onayanova.com"; + SmtpPassword = "mk8pmhzlf5hvzgh5"; + ConnectionSecurity = NotifyMailSecurity.SSLTLS; + SmtpServerPort = 587; + NotifyFromAddress = "support@ayanova.com"; + AyaNovaServerURL = "http://localhost:8080"; +#else SmtpDeliveryActive = false; SmtpServerAddress = "mail.example.com"; SmtpAccount = "notifydeliverfromaccount@example.com"; @@ -39,7 +39,7 @@ namespace AyaNova.Models SmtpServerPort = 587; NotifyFromAddress = "noreply@example.com"; AyaNovaServerURL = "https://url_to_my_ayanova_app"; - //#endif +#endif } }