From 98fef45cf1dc7ed7208a1c7c40a0b0702f762014 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 412428ecc..83f097050 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -509,6 +509,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