Avoid double-encoding subject if mbstring overloads mail function, fixes #133

This commit is contained in:
Synchro 2013-11-11 11:35:16 +01:00
parent 6730be8f10
commit 024c4f314c
1 changed files with 9 additions and 3 deletions

View File

@ -602,10 +602,16 @@ class PHPMailer
*/
private function mailPassthru($to, $subject, $body, $header, $params)
{
if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
$rt = @mail($to, $this->encodeHeader($this->secureHeader($subject)), $body, $header);
//Check overloading of mail function to avoid double-encoding
if (ini_get('mbstring.func_overload') & 1) {
$subject = $this->secureHeader($subject);
} else {
$rt = @mail($to, $this->encodeHeader($this->secureHeader($subject)), $body, $header, $params);
$subject = $this->encodeHeader($this->secureHeader($subject));
}
if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
$rt = @mail($to, $subject, $body, $header);
} else {
$rt = @mail($to, $subject, $body, $header, $params);
}
return $rt;
}