From 2b8eb74b7a5d6ecd6ce3601b2cc98847255c80fc Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Mon, 9 Aug 2021 09:17:32 -0500 Subject: [PATCH] Detect sending non-html emails as html (#13114) * Detect sending non-html emails as html and use
for line returns instead of \r\n * Fix style --- LibreNMS/Alert/Transport/Mail.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/LibreNMS/Alert/Transport/Mail.php b/LibreNMS/Alert/Transport/Mail.php index 5b3edafb1c..2628bb56a5 100644 --- a/LibreNMS/Alert/Transport/Mail.php +++ b/LibreNMS/Alert/Transport/Mail.php @@ -35,9 +35,17 @@ class Mail extends Transport public function contactMail($obj) { $email = $this->config['email'] ?? $obj['contacts']; - $msg = preg_replace("/(?isHtmlContent($obj['msg'])) { + // if there are no html tags in the content, but we are sending an html email, use br for line returns instead + $msg = preg_replace("/\r?\n/", "
\n", $obj['msg']); + } else { + // fix line returns for windows mail clients + $msg = preg_replace("/(?