From 9f231421be6ae5e934a01c4ff561d73207130585 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Mon, 17 Mar 2025 13:44:40 -0400 Subject: [PATCH] notifications should only convert line breaks to HTML for plain text messages --- Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs index ab9cc058..d65acb0a 100644 --- a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs +++ b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs @@ -130,7 +130,12 @@ namespace Oqtane.Infrastructure mailMessage.Subject = notification.Subject; //body - mailMessage.Body = notification.Body.Replace("\n", "
"); + 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", "
"); + } // encoding mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;