From 94c7f97f922a1b57e927d1d7222b817d64c2e638 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 21 Jan 2014 09:46:17 -0600
Subject: [PATCH] mail: Force *nix line endings with Suhosin

---
 include/class.mailer.php | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/class.mailer.php b/include/class.mailer.php
index f037e083c..0c64fa097 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -148,7 +148,19 @@ class Mailer {
             }
         }
 
-        $mime = new Mail_mime();
+        // The Suhosin patch will muck up the line endings in some
+        // cases
+        //
+        // References:
+        // https://github.com/osTicket/osTicket-1.8/issues/202
+        // http://pear.php.net/bugs/bug.php?id=12032
+        // http://us2.php.net/manual/en/function.mail.php#97680
+        if ((extension_loaded('suhosin') || constant("SUHOSIN_PATCH"))
+                && !$this->getSMTPInfo())
+            $mime = new Mail_mime("\n");
+        else
+            // Use defaults
+            $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
-- 
GitLab