PHP邮件可能无法正常工作的原因 [英] Reasons why PHP mail might not be working

查看:127
本文介绍了PHP邮件可能无法正常工作的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHP mail()函数从联系表单发送电子邮件。该函数返回 true 所以应该很好。但是我没有收到这封电子邮件。

I'm using the PHP mail() function to send email from a contact form. The function returns true so should be fine. But I'm not receiving the email.

我看过帖子,你应该总是使用在PHP邮件中的标题,以确保它的交付。我尝试过各种配置,但没有任何工作。

I've seen posts that say you should always use the From and Reply-To headers in PHP mail to make sure it's delivered. I've tried various configs but nothing is working yet.

有没有其他方法调试 mail()函数?

Is there any other way to debug the mail() function?

推荐答案

大多数时候这个问题是由于头,邮件可能会发送,但SMTP服务器可能永远不会由于错误的标题,所以提供它

Most of the time this problem is due to headers, the mail might get send but the SMTP server might never deliver it at all because of faulty headers

我建议您使用PHP的邮件类,例如 phpMailer ,它处理所有的问题与标题,并有一个非常好的界面使用

I'd suggest you to use a mailing class for PHP such as phpMailer which handles all of your problems with headers and has a really nice interface to use

欢呼

这篇关于PHP邮件可能无法正常工作的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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