我正在使用以下代码向我的网站成员发送电子邮件。脚本可以正常工作,用户可以收到电子邮件。但是,当发送电子邮件到Hotmail或Notes时,我遇到了编码问题。
代码如下:
代码如下:
$to = "to@email.com";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/plain; charset="utf-8"; format="flowed"' . "\r\n";
$headers .= 'Content-Transfer-Encoding: 8bit'. "\n\r\n";
$headers .= "To: John Doe<john@doe.com>" . "\r\n" .
"From: John Smith<john@smith.com" . "\r\n" .
"Reply-To: john@doe.com" . "\r\n" .
"Return-Path: john@doe.com" . "\r\n" .
"Sender: john@doe.com" . "\r\n" .
"X-Sender: john@doe.com" . "\r\n" .
"X-Mailer: JohnDoe". "\r\n".
"X-Report-Abuse: Please report abuse to: john@doe.com";
//If the e-mail was successfully sent...
$subject = $translation[104];
if(mail($to, $subject, $message, $headers)){
}
消息和主题都包含瑞典字母Å、Ä和Ö。实际消息在Hotmail中正确编码并显示,而主题则不是。您可以查看下面的图片获取更多信息:
图片:http://www.aspkoll.se/imgo/649
我很困惑。我已经搜索了几天并尝试了不同种类的解决方案,但恐怕没有任何成功。
您能否帮助我解决这个问题?
感激不尽!