Merge pull request #4686 from sbwalker/dev

add validation of recipient email address to Notification job
This commit is contained in:
Shaun Walker 2024-09-30 11:27:59 -04:00 committed by GitHub
commit e5d8c02def
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,9 +89,9 @@ namespace Oqtane.Infrastructure
} }
// validate recipient // 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; notification.IsDeleted = true;
notificationRepository.UpdateNotification(notification); notificationRepository.UpdateNotification(notification);
} }