开发者

PHP Mail - UTF 8 Encoding problems with Chinese characters

开发者 https://www.devze.com 2023-02-28 02:25 出处:网络
I have a PHP Mail script that sends out emails and I need to send some out in Chinese.I have the following code:

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 .= 开发者_如何学Python"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.


Looks like a database connection issue rather than a mailer issue. Perhaps forgot to do a set names utf-8...?

0

精彩评论

暂无评论...
验证码 换一张
取 消