add validation of recipient email address to Notification job

This commit is contained in:
sbwalker 2024-09-30 11:27:47 -04:00
parent be0754f568
commit 947aa08c42

View File

@ -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 + "<br />";
log += $"NotificationId: {notification.NotificationId} - Has Missing Or Invalid Recipient {notification.ToEmail}<br />";
notification.IsDeleted = true;
notificationRepository.UpdateNotification(notification);
}