optimizations to NotificationJob

This commit is contained in:
sbwalker
2025-09-19 09:05:35 -04:00
parent 70551f9d27
commit 442ec291a1

View File

@ -177,7 +177,7 @@ namespace Oqtane.Infrastructure
if (settingRepository.GetSettingValue(settings, "SMTPRelay", "False") != "True") if (settingRepository.GetSettingValue(settings, "SMTPRelay", "False") != "True")
{ {
fromEmail = settingRepository.GetSettingValue(settings, "SMTPSender", ""); fromEmail = settingRepository.GetSettingValue(settings, "SMTPSender", "");
fromName = !string.IsNullOrEmpty(fromName) ? fromName : site.Name; fromName = string.IsNullOrEmpty(fromName) ? site.Name : fromName;
} }
try try
{ {
@ -202,6 +202,7 @@ namespace Oqtane.Infrastructure
if (from != null && to != null) if (from != null && to != null)
{ {
// create mail message
MimeMessage mailMessage = new MimeMessage(); MimeMessage mailMessage = new MimeMessage();
mailMessage.From.Add(from); mailMessage.From.Add(from);
mailMessage.To.Add(to); mailMessage.To.Add(to);
@ -240,13 +241,14 @@ namespace Oqtane.Infrastructure
} }
else else
{ {
log += $"Notification Id: {notification.NotificationId} - Has An {error} And Has Been Deleted<br />"; log += $"Notification Id: {notification.NotificationId} Has An {error} And Has Been Deleted<br />";
notification.IsDeleted = true; notification.IsDeleted = true;
notificationRepository.UpdateNotification(notification); notificationRepository.UpdateNotification(notification);
} }
} }
log += "Notifications Delivered: " + sent + "<br />"; log += "Notifications Delivered: " + sent + "<br />";
} }
await client.DisconnectAsync(true); await client.DisconnectAsync(true);
} }
} }