From 947aa08c42adc33f45bd9fda5fe58608b86199f7 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Mon, 30 Sep 2024 11:27:47 -0400 Subject: [PATCH] add validation of recipient email address to Notification job --- Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs index b47c5732..ab9cc058 100644 --- a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs +++ b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs @@ -89,9 +89,9 @@ namespace Oqtane.Infrastructure } // validate recipient - if (string.IsNullOrEmpty(notification.ToEmail)) + if (string.IsNullOrEmpty(notification.ToEmail) || !MailAddress.TryCreate(notification.ToEmail, out _)) { - log += "Recipient Missing For NotificationId: " + notification.NotificationId + "
"; + log += $"NotificationId: {notification.NotificationId} - Has Missing Or Invalid Recipient {notification.ToEmail}
"; notification.IsDeleted = true; notificationRepository.UpdateNotification(notification); }