我有一个邮件服务器与SPF,DKIM和反向DNS配置良好.我可以使用以下内容向Outlook.com发送电子邮件:
echo "This is only a test" | mail username@outlook.com
Run Code Online (Sandbox Code Playgroud)
当我尝试使用相同的服务器通过PHP发送电子邮件时,会出现问题:
$header .= "Return-Path: Some User <mailsender@mydomain.com>\r\n";
$header .= "From: Some User <mailsender@mydomain.com>\r\n";
$header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "User-Agent: Some User Mail Sender\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n";
mail("usernama@outlook.com","My title", "Message body", $header);
Run Code Online (Sandbox Code Playgroud)
我尝试使用appmaildev.com验证我的消息,报告说:
DKIM result: fail (wrong body hash: <*** body hash ***>)
Run Code Online (Sandbox Code Playgroud)
即使出现此错误,Outlook.com也表示已通过DKIM验证,但PHP邮件功能发送的所有邮件都会转到垃圾邮件文件夹.以下是通过Bash和PHP直接发送的消息示例:http://pastebin.com/ndXJszic
谁能帮我?
谢谢.
编辑从标题中 删除\ r \n后,DKIM正文哈希错误消失了.但我还是无法向Outlook发送电子邮件......