PHP Mail - UTF 8 汉字编码问题
我有一个发送电子邮件的 PHP 邮件脚本,我需要用中文发送一些电子邮件。我有以下代码:
$email_header = "From: $from\n";
$email_header .= "X-Priority: 1\n"; //1 UrgentMessage, 3 Normal
$email_header .= "Return-Path: <$return>\n";
$email_header .= "Content-type: text/html; charset=utf-8\n";
mail($row["email"], '=?UTF-8?B?'.base64_encode($subject).'?=', $email_body, $email_header);
我遇到的问题是电子邮件的主题和正文 - 发送方式如下:
Subject: ???????????
Body: ???????????????
?????
??????????????????????????????????????????????????
?????
显然不是中文!如果有人能指出我正确的方向,那就太好了。
预先感谢,
荷马。
I have a PHP Mail script that sends out emails and I need to send some out in Chinese. I have the following code:
$email_header = "From: $from\n";
$email_header .= "X-Priority: 1\n"; //1 UrgentMessage, 3 Normal
$email_header .= "Return-Path: <$return>\n";
$email_header .= "Content-type: text/html; charset=utf-8\n";
mail($row["email"], '=?UTF-8?B?'.base64_encode($subject).'?=', $email_body, $email_header);
The issue I have is with both the Subject of the Email and the body - it is sending as follows:
Subject: ???????????
Body: ???????????????
?????
??????????????????????????????????????????????????
?????
Clearly not Chinese!!! If anyone can point me in the right direction, that would be great.
Thanks in advance,
Homer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来像是数据库连接问题而不是邮件程序问题。也许忘记了
设置名称 utf-8
...?Looks like a database connection issue rather than a mailer issue. Perhaps forgot to do a
set names utf-8
...?