PHP邮件函数总是返回false [英] PHP mail function always returning false
问题描述
我想从我的网站发送php邮件。我已经完成了以下步骤,但邮件仍然不起作用。它总是返回一个错误。
I want to send mails using php from my website. I have done the following steps but still the mail is not working. It is always returning a false.
我创建了一个邮件ID,然后更改了php.ini文件中的SMTP,smtp_port和sendmail_from值。我已经测试将SMTP和smtp设置为两个默认值(localhost和25)以及在cpanel(abc-22.example.net和465)的邮件客户端配置中给出的值。我也检查了phpinfo来检查这些值是否成功设置。我也检查了错误日志,没有错误记录在那里。安装在服务器上的php版本为5.4.24。
I have created a mail id and then has changed SMTP, smtp_port and sendmail_from values in php.ini file. I have tested setting the SMTP and smtp to both default values(localhost and 25) and the values given in mail client config of cpanel (abc-22.example.net and 465). I have also checked phpinfo to check whether those values were set successfully. I have checked the error log also, no errors logged there. The php version installed on server is 5.4.24.
推荐答案
始终使用SMTP验证通过phpmailer发送邮件。某些主机端不允许使用mail()。因为这是一个垃圾邮件。
Always use SMTP Authentication for mail sending by using phpmailer. mail() is not allowed on some hosting side. Because of spaming.
点击这里!
这篇关于PHP邮件函数总是返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!