Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP向Hotmail发送电子邮件时的编码问题_Php_Email_Encoding_Hotmail - Fatal编程技术网

使用PHP向Hotmail发送电子邮件时的编码问题

使用PHP向Hotmail发送电子邮件时的编码问题,php,email,encoding,hotmail,Php,Email,Encoding,Hotmail,我使用以下代码向我网站的成员发送电子邮件。脚本工作,用户收到电子邮件。但是,我在向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-T

我使用以下代码向我网站的成员发送电子邮件。脚本工作,用户收到电子邮件。但是,我在向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)){

}
$to=”to@email.com";
$headers='MIME版本:1.0'。“\r\n”;
$headers.='内容类型:文本/普通;charset=“utf-8”;format=“flowed””。“\r\n”;
$headers.='内容传输编码:8bit'。“\n\r\n”;
$headers.=“收件人:John Doe”。“\r\n”。
From:John Smith试试。它适用于雅虎邮件、Gmail和Hotmail


注意:Hotmail很烂。:)

电子邮件主题和其他标题内容(如名称)使用

php.net对的评论给出以下示例:

mail($mail, "=?utf-8?B?".base64_encode ($subject)."?=", $message, $headers);

你的邮件头不能有非ASCII码。这是违反规定的。谢谢。这对我帮助很大!