Merge pull request #5174 from sbwalker/dev

notifications should only convert line breaks to HTML for plain text messages
This commit is contained in:
Shaun Walker 2025-03-17 13:45:02 -04:00 committed by GitHub
commit e4ece3e0dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -130,7 +130,12 @@ namespace Oqtane.Infrastructure
mailMessage.Subject = notification.Subject;
//body
mailMessage.Body = notification.Body.Replace("\n", "<br />");
mailMessage.Body = notification.Body;
if (!mailMessage.Body.Contains("<") || !mailMessage.Body.Contains(">"))
{
// plain text messages should convert line breaks to HTML tags to preserve formatting
mailMessage.Body = mailMessage.Body.Replace("\n", "<br />");
}
// encoding
mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;