From 9fcff6931d73d1e3ecf94339f09c380396f2cfd3 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Tue, 23 Oct 2012 14:22:19 -0400
Subject: [PATCH] Remove forced utf8 encoding and let the PEAR/Mail/smtp handle
 it

---
 include/class.mailer.php | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/include/class.mailer.php b/include/class.mailer.php
index 482f01960..8f22c6431 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -66,7 +66,7 @@ class Mailer {
     function getFromAddress() {
 
         if(!$this->ht['from'] && ($email=$this->getEmail()))
-            $this->ht['from'] =sprintf('"%s" <%s>', $this->str_utf8($email->getName()?$email->getName():$email->getEmail()), $email->getEmail());
+            $this->ht['from'] =sprintf('"%s" <%s>', ($email->getName()?$email->getName():$email->getEmail()), $email->getEmail());
 
         return $this->ht['from'];
     }
@@ -84,12 +84,6 @@ class Mailer {
         $this->attachments = array_merge($this->attachments, $attachments);
     }
 
-    /* utils */
-
-    function str_utf8($text) {
-        return "=?utf-8?b?".base64_encode($text)."?=";
-    }
-
     function send($to, $subject, $message, $options=null) {
         global $ost;
 
@@ -109,7 +103,7 @@ class Mailer {
         $headers = array (
                 'From' => $this->getFromAddress(),
                 'To' => $to,
-                'Subject' => $this->str_utf8($subject),
+                'Subject' => $subject,
                 'Date'=> date('D, d M Y H:i:s O'),
                 'Message-ID' => $messageId,
                 'X-Mailer' =>'osTicket Mailer',
@@ -140,7 +134,7 @@ class Mailer {
         //encode the body
         $body = $mime->get($encodings);
         //encode the headers.
-        $headers = $mime->headers($headers);
+        $headers = $mime->headers($headers, true);
         if(($smtp=$this->getSMTPInfo())) { //Send via SMTP
             $mail = mail::factory('smtp',
                     array ('host' => $smtp['host'],
-- 
GitLab