optimizations to NotificationJob
This commit is contained in:
@ -103,7 +103,7 @@ namespace Oqtane.Infrastructure
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
await client.ConnectAsync(settingRepository.GetSettingValue(settings, "SMTPHost", ""),
|
await client.ConnectAsync(settingRepository.GetSettingValue(settings, "SMTPHost", ""),
|
||||||
int.Parse(settingRepository.GetSettingValue(settings, "SMTPPort", "")),
|
int.Parse(settingRepository.GetSettingValue(settings, "SMTPPort", "")),
|
||||||
secureSocketOptions);
|
secureSocketOptions);
|
||||||
|
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user