PHP邮件未发送,如何调试? [英] PHP mail does not get sent, how do I debug?
问题描述
我一直在尝试发送电子邮件进行注册,邀请等。
I have been trying to send email for registration, invitations and so on.
在本地开发中,会发送电子邮件。但是,一旦在服务器上没有邮件到达。
On local development, emails get sent. However once on the server no mails arrive.
我安装了后缀。我试图设置邮件服务器,但放弃了。因此,当前,如果我输入终端机
I installed postfix. I was trying to setup a mail server but gave up. So currently, If I type in terminal
peter# mail example@example.com
电子邮件到达。但是,这不会发送电子邮件:
the email arrives. However, this does not send email:
$res = mail('example@example.com', 'subj', 'bodddd');
不仅如此,而且回显 $ res
什么也没给。 true
和 false
都不是。
not only that, but echoing $res
gives nothing. Neither true
nor false
.
做什么以及如何做我确实要使其正常工作?
What and how do i do to make it working?
谢谢
推荐答案
您上面的评论,看来您的sendmail路径错误或在php.ini中被注释掉了。应该是这样的:
According to your comment above, it looks like your sendmail path is either wrong or commented out in your php.ini. It should be something like this:
sendmail_path = /usr/sbin/sendmail -t -i
如果不确定sendmail二进制文件所在的位置,则可以使用以下方式找到它:
If you're unsure where your sendmail binary resides, you may find it by using:
whereis sendmail
这篇关于PHP邮件未发送,如何调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!