diff --git a/class.phpmailer.php b/class.phpmailer.php index 916e69ab..35ad763e 100644 --- a/class.phpmailer.php +++ b/class.phpmailer.php @@ -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; }