使用bluehost搭建wordpress都有这个问题,收到评论的邮件全部是乱码,通过搜索引擎,我找到了ishawn给出的解决办法,因此将原文引用在下面,所有链接无任何修改:
以前使用国内的空间没有遇到过这种问题,可以确定是编码不同造成的。Google了一下相关的内容,发现我和别人的遭遇不太一样。大多数Wordpress使用者收到的邮件仅仅是标题乱码,而我接收到的邮件连内容都是。Cube同学写了一个插件来 解决邮件标题乱码的问题,这个插件的原理是替换掉Pluggable.php内的邮件发送部分,自行指定该部分的编码。结合我自己的情况,将 Pluggable.php内的wp_mail部分重写,分别指定邮件头、邮件标题和邮件正文的编码为base64也就是utf-8就可以了。考虑到日后 升级会比较麻烦,也可以将修改后的wp_mail部分写入my-hacks.php这个文件,启用my-hacks.php支持以后,这个文件内的修改内 容就会替换掉原有pluggable.php内的功能字段。顺便附上修改好的my-hacks.php,使用时先到后台的“选项-杂项”内开启my-hacks.php支持,然后将其放置在wp根目录下即可。
如果你连下载都懒得做的话,下面我给出了my-hacks.php文件的php代码:
< ?php
function wp_mail($to, $subject, $message, $headers = '') {
$subject = '=?' . get_option('blog_charset') . '?B?' . base64_encode($subject) . '?=';
$mailcontents = explode("\n\n--", $message, 2);
if (count($mailcontents) == 1) {
$message = base64_encode($mailcontents[0]);
} else {
$message = base64_encode($mailcontents[0]) . "\n\n--" . $mailcontents[1];
}
if ($headers == '') {
$headers = "MIME-Version: 1.0\n" .
"From: wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])) . "\n" .
"Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
}
$mailheaders = explode("\n", $headers);
$headers = '';
foreach ($mailheaders as $line) {
$mailheader = explode(":", $line);
$fieldType = trim($mailheader[0]);
if ($fieldType == 'To' || $fieldType == 'From' || $fieldType == 'Reply-To') {
$field = trim(str_replace('"', '', $mailheader[1]));
if (strpos($field, '<') !== false && strpos($field, '>')) {
$fieldAddr = trim(substr($field, strpos($field, '< ') + 1));
$fieldAddr = str_replace('>', '', $fieldAddr);
$fieldName = '=?' . get_option('blog_charset') . '?B?' . base64_encode(trim(str_replace('"', '', substr($mailheader[1], 0, strpos($mailheader[1], '< ') - 1)))) . '?=';
} else {
$fieldAddr = $field;
$fieldName = $fieldAddr;
}
$headers .= "$fieldType: $fieldName <$fieldAddr>\n";
} else {
if ($line != '') {
$headers .= "$line\n";
}
}
}
if (!strpos($headers, 'Content-Transfer-Encoding')) {
$headers .= "Content-Transfer-Encoding: base64\n";
}
return mail($to, $subject, $message, $headers);
}
?>

Great!!