My support system running on the Taiwan side,
I installed osticket 1.6 stable, then did some test,
When I got email from osticket system,
I found message was correct, but subject became illegible.
(all chinese character illegible, but english was correct.)
I think I had fixed this issue now, I post my modified here, hope it is helpful.
PHP: Version 5.2
DB: MySQL 5.1
Confirm: All of osticket database and tables charset are UTF-8.
File: /include/pear/Mail/mime.php
function Mail_mime($crlf = "\r\n")
{
$this->_setEOL($crlf);
$this->_build_params = array(
'head_encoding' => 'base64',
'text_encoding' => '7bit',
'html_encoding' => 'base64',
'7bit_wrap' => 998,
'html_charset' => 'UTF-8',
'text_charset' => 'UTF-8',
'head_charset' => 'UTF-8'
);
}
File: /include/class.email.php
@@ -164,7 +164,6 @@
'Date'=>date('D, d M Y H O'),
'Message-ID' =>'<'.Misc:(6).''.time().'-'.$this->getEmail().'>',
'X-Mailer' =>'osTicket v 1.6',
- 'Content-Type' => 'text/html; charset="UTF-8"'
);
$mime = new Mail_mime();
$mime->setTXTBody($body);
@@ -172,10 +171,11 @@
if($attachment && $attachment && is_readable($attachment)) { //file of mime type.
$mime->addAttachment($attachment,$attachment,$attachment);
}
- $options=array('head_encoding' => 'quoted-printable',
- 'text_encoding' => 'quoted-printable',
+ $options=array('head_encoding' => 'base64',
+ 'text_encoding' => '7bit',
'html_encoding' => 'base64',
'html_charset' => 'utf-8',
+ 'head_charset' => 'utf-8',
'text_charset' => 'utf-8');
//encode the body
$body = $mime->get($options);
@@ -222,14 +222,14 @@
'Subject' => $subject,
'Message-ID' =>'<'.Misc:(10).''.time().'@osTicket>',
'X-Mailer' =>'osTicket v 1.6',
- 'Content-Type' => 'text/html; charset="UTF-8"'
);
$mime = new Mail_mime();
$mime->setTXTBody($body);
- $options=array('head_encoding' => 'quoted-printable',
- 'text_encoding' => 'quoted-printable',
+ $options=array('head_encoding' => 'base64',
+ 'text_encoding' => '7bit',
'html_encoding' => 'base64',
'html_charset' => 'utf-8',
+ 'head_charset' => 'utf-8',
'text_charset' => 'utf-8');
//encode the body
$body = $mime->get($options);
this patch also solved email subject length issue.
( When charset is UTF-8 and encode by quoted-printable,
If encoded subject text length over 74 bytes, subject become NULL in sent email. This is a problem in DBCS system, like Japanese and Chinese.)