From bb2d5c952fe74af44fbdc2aa5c8000e7f5bd103e Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 7 Jan 2014 11:12:23 -0600
Subject: [PATCH] email: (Almost) always convert html on text body

This is especially important if the html ticket thread is disabled. In such
a case the message body will still be HTML, but an HTML email should not be
sent out.
---
 include/class.mailer.php | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/class.mailer.php b/include/class.mailer.php
index a57f8d7be..21a7d157d 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -139,12 +139,11 @@ class Mailer {
 
         $mime = new Mail_mime();
 
+        // If the message is not explicitly declared to be a text message,
+        // then assume that it needs html processing to create a valid text
+        // body
         $isHtml = true;
-        // Ensure that the 'text' option / hint is not set to true and that
-        // the message appears to be HTML -- that is, the first
-        // non-whitespace char is a '<' character
-        if (!(isset($options['text']) && $options['text'])
-                && (!$cfg || $cfg->isHtmlThreadEnabled())) {
+        if (!(isset($options['text']) && $options['text'])) {
             // Make sure nothing unsafe has creeped into the message
             $message = Format::safe_html($message); //XXX??
             $mime->setTXTBody(Format::html2text($message, 90, false));
-- 
GitLab