Okay, I'm at my whit's end here. I have a client whose site is hosted on GoDaddy and that uses Outlook. I've written a PHP script to send mail to one of their domain e-mail addresses from a contact form on their website.

I can get this e-mail to send to every single service except outlook/exchange/live/microsoft accounts.

I read that using PHPMailer was a good idea, so this is what I'm currently using to send mail:

//$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug  = 2;                      
$mail->SMTPAuth   = true;                   
$mail->SMTPSecure = "ssl";                  
$mail->Host       = "a2plcpnl0287.prod.iad2.secureserver.net";       
$mail->Port       = 465;                    
$mail->Username   = "test@alamohomefinance.com";    
$mail->Password   = "xxxxxxx";          
$mail->SetFrom('yourname@yourdomain.com', 'First Last');
$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->Subject    = "PHPMailer Test Subject via smtp (hotmail), basic";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; 

$address = "jakerevans2@live.com"; 

if(!$mail->Send()) {
    error_log("Error from calculator!". $mail->ErrorInfo); 
} else {
 error_log("Success from calculator!");

This e-mail gets sent to my gmail account and some others, but not to my .live account or my client's Outlook address.

I've tried everything I've found on the internet so far, nothing is working. Any ideas or thoughts anyone?


EDIT: The Godaddy server has an SPF record that reads: v=spf1 include:spf.protection.outlook.com -all

I've created a DKIM key from https://www.port25.com/dkim-wizard/ and added a DKIM TXT record to GoDaddy, with the following details:

Host: key1._domainkey.alamohomefinance.com TXT Value: k=rsa\; p=MIIBIjA...

I've added a DKIM record, with the following details: Name: _dmarc.alamohomefinance.com TXT Value: v=DMARC1; p=quarantine; sp=none; ruf=mailto:user@example.com; rf=afrf; pct=100; ri=86400

Am testing now to see if these changes make a difference...

douda5227 那么设置SMTPDebug=2会让你看到它在做什么?你仍然显然试图将SMTP与POP3服务器对话-我测试了它,它正在运行Dovecot,绝对不能与PHPMailer一起使用。你需要停止做随意的事情并在逻辑上处理它!
大约 4 年之前 回复
doushua7737 它有一个SPF记录,它默认有一个,我在原始问题中放置的那个。我在某个地方发现了一些东西,以确保它是一个破折号,而不是在“全部”部分前面的波浪号,所以我去检查它就在那里。此外,我已经读过,如果发送它的smtp主机具有SPF记录,这可能有助于Outlook不将收到的电子邮件视为垃圾邮件。到目前为止它没有工作。
大约 4 年之前 回复
dopq87915 GoDaddy服务器根本没有SPF记录,也不需要一个,因为它只是出站的。
大约 4 年之前 回复
duanhang032796 您没有使用DKIM签名,因此无济于事。首先获得基础知识!
大约 4 年之前 回复
doubao12345 是的,我的脚本工作,甚至没有最终在我的jakerevans2@live.com帐户的垃圾文件夹中
大约 4 年之前 回复
dongna2498 由于它是针对某些帐户而不是其他帐户,因此问题不在于您的脚本。如果它有问题,它不会发送到任何地方。所以它被目的地网站过滤了。
大约 4 年之前 回复
douyan1244 垃圾邮件过滤器在许多可能的位置-我的猜测
大约 4 年之前 回复


First up, you should look at the PHPMailer troubleshooting guide, which has a little section on GoDaddy, and many other problems.

You will get much better feedback on what's going on if you enable debug output of server messages, so set SMTPDebug = 2, and see what it says.

GoDaddy is known to block outbound SMTP, and generally will either simply fail to connect (see many questions on SO about that), or cause TLS verification failures as you get redirected transparently to their mail servers.

In your code you've got the smtp.live.com Host, but this username:

$mail->Username   = "a2plcpnl0287.prod.iad2.secureserver.net"

secureserver.net is the domain used for GoDaddy's mail servers, and that user name is the name of an actual GoDaddy mail server, so it seems very unlikely that you should be using it as a user id for live.com, especially since GoDaddy will be rotating mail servers frequently, so you're unlikely to get the same one every time - is that really your login ID for live.com?

I'm also suspicious of the phrasing of your question: you do not need to connect to live.com to send email to live.com - there's nothing stopping you sending to a live.com address from a connection through gmail, so it sounds like you may have a conceptual issue. The Host, Username and Password properties are for the mail server that you send out through, not that you are sending mail to.

As I said, normally GoDaddy doesn't allow remote SMTP at all, so I'm very surprised if you've had it working without using a GoDaddy mail server, so I suspect you've had something else work, not what you think.

I can also see you've based your code on an obsolete example, so make sure you're running the latest PHPMailer.


I noticed something critical. The code does not call $mail->isSMTP();. This means that it's not using SMTP at all, it's using the default mail() function, and as such none of the SMTP config makes any difference at all. The message will be submitted to your local mail server, which will then relay through GoDaddy's server. Look in your mail server's log file to see what's happening, usually in /var/log/mail.log or similar.

douyingbei1458 不,看到我的更新 - 它没有使用任何SMTP配置,因此根本不使用端口,主机,用户名和密码,SMTPDebug,SMTPSecure和SMTPAuth属性 - 您可以删除它们!
大约 4 年之前 回复
douqiang1851 谢谢你,抓住了错误的GoDaddy配置部分。 仍然使用995发送。呵呵。 设置调试将告诉我在电子邮件服务器日志中发生了什么? 我将不得不请求godaddy访问那些,如果那是那些。
大约 4 年之前 回复
dongpiao8821 港口995 ?? 这是入站加密POP3的端口?! 如果你使用ssl,我希望它使用端口465.另外,像我说的那样设置SMTPDebug = 2,然后你会看到发生了什么。
大约 4 年之前 回复
dongye7231 我编辑了我正在使用的代码...我复制/粘贴了一个不太好的例子。 但是,使用上面的代码,我们回到原始问题,电子邮件被发送,并到达除.live / outlook / exchange收件箱之外的所有地方。
大约 4 年之前 回复
doulianqi3870 但是你最初发布的代码没有任何意义 - 你仍然使用GoDaddy主机名(一个不正确的主机名)作为live.com的用户ID。 不会工作......
大约 4 年之前 回复
douche5961 对@nogad,问题是我无法收到电子邮件,我可以使用godaddy的服务器(a2plcpnl0287.prod.iad2.secureserver.net)或另一个(在这种情况下,smpt。 live.com)。 我只是无法将邮件收到我的.live收件箱,也不能收到我客户的Outlook收件箱。 他们出现在gmail和其他人就好了。
大约 4 年之前 回复
dongye1942 但是......他说它发送的很好,它只是特别的帐户,没有收到电子邮件。 所以以上都不是实际相关的
大约 4 年之前 回复

上检查您的服务器IP http://mxtoolbox.com/blacklists.aspx 。 我注意到微软对黑名单非常挑剔。 我遇到了一个全新的I.P地址,这个地址是通过明显的不良代表获得的。 如果您在共享帐户IP上的godaddy,则很可能默认情况下阻止ip或整个子网。 </ p>
</ div>



Check your server ip on http://mxtoolbox.com/blacklists.aspx . I've noticed Microsoft is very picky about blacklisting. I've had this issue with a brand new I.P addresses that were acquired with an apparent bad rep. If your on godaddy on a shared account ip it's very likely either the ip or entire subnets are blocked by default.

Csdn user default icon