如果发件人标头包含斯堪的纳维亚字符,Pear Mail 将不会发送
想象一下:
$from = "Testäöå <[email protected]>";
....
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject,
'MIME-Version' => "1.0",
'Content-type' => "text/html; charset=iso-8859-1");
如果 $from 变量只是 "Test <[email protected]>"
,脚本工作正常。
Imagine the following:
$from = "Testäöå <[email protected]>";
....
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject,
'MIME-Version' => "1.0",
'Content-type' => "text/html; charset=iso-8859-1");
If the $from variable is just "Test <[email protected]>"
, script works fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您直接指定标头,因此需要手动转义它们。标头中只允许使用 ASCII 字符,因此您需要对它们进行转义。
您可以这样做,即使用
或者,您可以使用多字节字符串函数,如 http://pear.php.net/manual/en/package.mail.mail.send.php :
Since you're specifying the headers directly, you need to escape them manually. Only ASCII characters are allowed in headers, so you need to escape them.
You can do that i.e. with
Alternatively, you can use the Multibyte string functions as described in the comments of http://pear.php.net/manual/en/package.mail.mail.send.php :