为什么我不能向Hotmail发送电子邮件? [英] Why can't I send an email to Hotmail?
问题描述
这是我的代码:
$boundary = sha1('whatever');
$headers = 'MIME-Version: 1.0'."\r\n";
$headers .= 'From: "Domainname" emailname@domain.com'."\r\n";
$headers .= 'Reply-to: Domainname <emailname@domain.com>'."\r\n";
$headers .= 'X-Priority: 3'."\r\n";
$headers .= 'X-Mailer: Mail 1.0'."\r\n";
$headers .= 'Subject: '.$subject."\r\n";
$headers .= 'Content-Type: multipart/alternative; boundary="'.$boundary.'"'."\r\n\r\n";
$message = '--'.$boundary."\r\n";
$message .= 'Content-Type: text/plain; charset="utf-8"'."\r\n\r\n";
$message .= $text."\r\n";
$message .= '--'.$boundary."\r\n";
$message .= 'Content-Type: text/html; charset="utf-8"'."\r\n\r\n";
$message .= $html."\r\n";
$message .= '--'.$boundary.'--';
mail($email, $subject, $message, $headers);
它适用于Gmail,Yahoo,GMX ...但它不适用于Hotmail / Live / MSN。
It worked for Gmail, Yahoo, GMX ...but it didn't work for Hotmail/Live/MSN.
因为它适用于Gmail,我可以假设它与我的服务器无关,对吧?
Because it worked for Gmail, I can assume that it has nothing to do with my server, right?
我也尝试过:
mail('username@hotmail.com', 'This is a subject', 'This is the body');
同样的问题。它甚至不会发送到我的垃圾文件夹。
Same problem. It doesn't even get send to my junk folder.
推荐答案
旧答案:
Hotmail阻止没有SPF记录的域。您可以制作一个此处
Hotmail blocks domains without an SPF record. you can make one here
编辑:
edit:
截至2015年6月,常见要求是:
As of June 2015, common requirements are:
1)DKIM在Exim中启用DKIM现在是减少电子邮件被标记为垃圾邮件的机会的重要工具。强烈建议您为您的域启用DKIM。
1) DKIM Enabling DKIM in Exim is now a very important tool to reduce the chance of your emails being flagged as spam. It's highly recommended to enable DKIM for your domains.
2)SPF记录与-all而不是〜全部
2) SPF record with -all instead of ~all
3)DMARC记录以帮助远程服务器决定如何处理失败的DKIM / SPF消息。
3) DMARC records to help remote servers decide what to do with failed DKIM/SPF messages.
4)通常情况下,a)像发送IP的反向IP查找,b)正确查找该rDNS值,最好指向相同的IP,c)主机名上的MX记录。
4) The usual things, a) like reverse IP lookup on sending IP, b) forward lookup on that rDNS value preferably pointing to same IP, c) MX record on hostname.
示例:
"v=spf1 a mx ip4:1.2.3.4 -all"
其中1.2.3.4是您的服务器的IP。
Where 1.2.3.4 is the ip of your server.
这篇关于为什么我不能向Hotmail发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!