From 442ec291a1b64a9081a78cf85cfbef9258206fc2 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Fri, 19 Sep 2025 09:05:35 -0400 Subject: [PATCH] optimizations to NotificationJob --- Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs index e6c018da..85e16ff9 100644 --- a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs +++ b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs @@ -103,7 +103,7 @@ namespace Oqtane.Infrastructure break; } - await client.ConnectAsync(settingRepository.GetSettingValue(settings, "SMTPHost", ""), + await client.ConnectAsync(settingRepository.GetSettingValue(settings, "SMTPHost", ""), int.Parse(settingRepository.GetSettingValue(settings, "SMTPPort", "")), secureSocketOptions); @@ -177,7 +177,7 @@ namespace Oqtane.Infrastructure if (settingRepository.GetSettingValue(settings, "SMTPRelay", "False") != "True") { fromEmail = settingRepository.GetSettingValue(settings, "SMTPSender", ""); - fromName = !string.IsNullOrEmpty(fromName) ? fromName : site.Name; + fromName = string.IsNullOrEmpty(fromName) ? site.Name : fromName; } try { @@ -202,6 +202,7 @@ namespace Oqtane.Infrastructure if (from != null && to != null) { + // create mail message MimeMessage mailMessage = new MimeMessage(); mailMessage.From.Add(from); mailMessage.To.Add(to); @@ -240,13 +241,14 @@ namespace Oqtane.Infrastructure } else { - log += $"Notification Id: {notification.NotificationId} - Has An {error} And Has Been Deleted
"; + log += $"Notification Id: {notification.NotificationId} Has An {error} And Has Been Deleted
"; notification.IsDeleted = true; notificationRepository.UpdateNotification(notification); } } log += "Notifications Delivered: " + sent + "
"; } + await client.DisconnectAsync(true); } }