我正在使用以下代码向我的网站成员发送电子邮件。该脚本有效,并且用户收到了电子邮件。但是,我在向 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
我很困惑。我已经搜索了几天并尝试了不同类型的解决方案,但恐怕没有任何成功。
你能帮我解决这个问题吗?
赞赏!