如何格式化Hotmail / Outlook快乐的电子邮件? [英] How to format an email that Hotmail / Outlook is happy with?

查看:1448
本文介绍了如何格式化Hotmail / Outlook快乐的电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$body = 'This is a test';
    $subject = 'Confirmation';
$headers = 'From: Testing Site' . "\r\n";
$headers .= 'Reply-To: admin@myserver.com' . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html;charset=iso-8859-1' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion(). "\r\n";
$headers .= 'Delivery-Date: ' . date("r") . "\r\n";
//$headers .= 'Message-Id: <20140316055950.DA8ED58A13CE@myserver.com>' . "\r\n";

mail("example@hotmail.com", $subject, $body, $headers, "-f admin@myserver.com");
mail("example@gmail.com", $subject, $body, $headers, "-f admin@myserver.com");

电子邮件发送到Gmail,但总是被Hotmail拒绝,出现以下错误:

Emails send fine to Gmail but are always rejected by Hotmail with this error:


主机mx1.hotmail.com [65.55.33.119]说:550 5.7.0(COL0-MC5-F28)
无法发送消息。请确保消息符合RFC 5322
标准。 (回复DATA命令的结尾)。

host mx1.hotmail.com[65.55.33.119] said: 550 5.7.0 (COL0-MC5-F28) Message could not be delivered. Please ensure the message is RFC 5322 compliant. (in reply to end of DATA command).

消息ID标头是由服务器自动生成的,但不能提供一个手动的。

Message ID header is generated automatically by the server but it doesn't help to supply one manually either.

为什么Hotmail不开心?

Why isn't Hotmail happy?

邮件服务器有SPF记录,反向DNS,没有列入黑名单,并通过mxtoolbox.com上的所有支票。

Mail server has SPF record, reverse DNS, is not blacklisted and passes all checks at mxtoolbox.com.

推荐答案

From 标题无效。它必须具有以下语法:

The From header is invalid. It must have the following syntax:

From: "name" <email-address>

在您的情况下:

From: "Testing Site" <admin@myserver.com>

你的回复到标题:

Reply-To: "Testing Site" <admin@myserver.com>

如果与 From 标题(就像你的情况)。

Which you can omit if it's the same as the From header (like in your case).

PS: RFC 2822 声明地址中的显示名称应该被引用。换句话说:以下3个标题应该都可以正常工作:

PS: RFC 2822 doesn't state that the display-name in an address should be quoted. In other words: the following 3 headers should all work:

From: "Testing Site" <admin@myserver.com>
From: 'Testing Site' <admin@myserver.com>
From: Testing Site <admin@myserver.com>

这篇关于如何格式化Hotmail / Outlook快乐的电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆