notifications should only convert line breaks to HTML for plain text messages

This commit is contained in:
sbwalker 2025-03-17 13:44:40 -04:00
parent 62879c3e52
commit 9f231421be

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;