From 857dd224a3a8854a3682f737311c46b97d7b3789 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 4 May 2015 22:32:32 -0500
Subject: [PATCH] mail: Ensure proper encoding of the To header

When using the php mail() function, the To: header encoded in the Mail_mime
library was not properly transferred to the $to variable passed to the mail
backend. The mail() function will add its own To: header which will
mimic the received destination address.

This patch ensures that the $to parameter is properly encoded.
---
 include/class.mailer.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/class.mailer.php b/include/class.mailer.php
index 9c7638bce..316d32e09 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -443,6 +443,8 @@ class Mailer {
 
         //No SMTP or it failed....use php's native mail function.
         $mail = mail::factory('mail');
+        // Ensure the To: header is properly encoded.
+        $to = $headers['To'];
         return PEAR::isError($mail->send($to, $headers, $body))?false:$messageId;
 
     }
-- 
GitLab