phpmailer使用sendmail发送邮件总是乱码,对EncodeHeader方法稍作修改:
phpmailer v5.1
原1522行:
public function EncodeHeader($str, $position = 'text') {
$x = 0;
导致执行到1547行就直接返回数据
if ($x == 0) {
return ($str);
}
将1522行进行修改
public function EncodeHeader($str, $position = 'text', $x=0) {
即可通过
$str = $mail->EncodeHeader($str,'text', 1);
来对头数据进行编码,中文显示正常