Skip to content
Snippets Groups Projects
Commit d3404b02 authored by Peter Rotich's avatar Peter Rotich
Browse files

Make sure subject & FROM name are UTF-8 encoded

parent ca6e1bc6
No related branches found
No related tags found
No related merge requests found
......@@ -65,8 +65,8 @@ class Mailer {
function getFromAddress() {
if(!$this->ht['from'] && $this->getEmail())
$this->ht['from'] =$this->getEmail()->getAddress();
if(!$this->ht['from'] && ($email=$this->getEmail()))
$this->ht['from'] =sprintf('"%s" <%s>', $this->str_utf8($email->getName()?$email->getName():$email->getEmail()), $email->getEmail());
return $this->ht['from'];
}
......@@ -84,6 +84,12 @@ 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;
......@@ -103,7 +109,7 @@ class Mailer {
$headers = array (
'From' => $this->getFromAddress(),
'To' => $to,
'Subject' => $subject,
'Subject' => $this->str_utf8($subject),
'Date'=> date('D, d M Y H:i:s O'),
'Message-ID' => $messageId,
'X-Mailer' =>'osTicket Mailer',
......@@ -142,7 +148,7 @@ class Mailer {
'auth' => $smtp['auth'],
'username' => $smtp['username'],
'password' => $smtp['password'],
'timeout' =>20,
'timeout' => 20,
'debug' => false,
));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment