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条)

报告相同问题?

悬赏问题

  • ¥100 关于#VijeoCitect#的问题,如何解决?(标签-ar|关键词-数据类型)
  • ¥30 数字信号处理实验报告
  • ¥15 一个矿井排水监控系统的plc梯形图,求各程序段都是什么意思
  • ¥15 ensp路由器启动不了一直报#
  • ¥50 安卓10如何在没有root权限的情况下设置开机自动启动指定app?
  • ¥15 ats2837 spi2从机的代码
  • ¥200 wsl2 vllm qwen1.5部署问题
  • ¥100 有偿求数字经济对经贸的影响机制的一个数学模型,弄不出来已经快要碎掉了
  • ¥15 数学建模数学建模需要
  • ¥15 已知许多点位,想通过高斯分布来随机选择固定数量的点位怎么改