dsbruqxgt820011351 2009-10-23 09:17
浏览 123
已采纳

PHP mail() - 未收到电子邮件

I have set up an AJAX contact form on a client's website.

The problem is that the email is not getting through to the client's inbox.

I set up the client with Google Apps (in the same way I did for myself).

I used the same contact form with my email address and it works. But with any email addresses on their domain it doesn't!

All members of the domain are receiving 'ordinary' emails.

What could be the difference that's stopping mail() emails getting through?


UPDATE

Ok so I managed to solve it. Turns out that using a CNAME to point the domain to the correct server wasn't enough for sendmail so I had to change it to an A record pointing directly to the server. Strange but true. Thanks for the help folks, you pointed me in the right direction :)

  • 写回答

2条回答 默认 最新

  • drs7798 2009-10-23 09:30
    关注

    It depends on the both settings on your server and the server on the receiving end.

    hotmail for example requires the use of correctly configured SPF records.

    many mail-receiving servers (including hotmail) require the email to originate from a Fully Qualified Domain Name. It is very possible that your e-mails send from PHP do not comply with this rule. (there is a good chance they originate from 'apache')
    see hotmail self help and hotmail postmaster info

    PHP's mail() function does not include a lot of headers with your mail, so you will need to supply them yourself.

    The more hops your mail makes on it's way to it destination, the more likely it is to be tagged as spam. So it might be a better option not to use PHP's mail function and instead use a mail library that connects to an SMTP server just like your desktop mail application does.

    All in all, I would place my bets on an external library: Pear::Mail (documentation)

    You could also read: how do you make sure email you send programmatically is not automatically marked as spam

    UPDATE
    Failing the SenderId or SPF check can get your message dropped before it even hits the users inbox. The message will not end up in the users junk folder, it will go directly to /dev/null. I know this is at least true for hotmail and live mail. I see no reason for other hosts not to have implemented the same policy.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制