From 15780467eb8d590317d951a9972bf89067b7df4b Mon Sep 17 00:00:00 2001 From: FreeScout Date: Sat, 16 Dec 2023 04:09:15 -0800 Subject: [PATCH] Do not strip HTML tags in plain text emails - closes #3614 --- app/Console/Commands/FetchEmails.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/FetchEmails.php b/app/Console/Commands/FetchEmails.php index c1679d383..3b68f301a 100644 --- a/app/Console/Commands/FetchEmails.php +++ b/app/Console/Commands/FetchEmails.php @@ -593,12 +593,15 @@ public function processMessage($message, $message_id, $mailbox, $mailboxes, $ext // Get body and do not replace :cid with images base64 $html_body = $message->getHTMLBody(false); } + $is_html = true; + if ($html_body) { $body = $html_body; } else { $is_html = false; - $body = $message->getTextBody(); + $body = $message->getTextBody() ?? ''; + $body = htmlspecialchars($body); } $body = $this->separateReply($body, $is_html, $is_reply, !$message_from_customer);