VPS使用军哥的lnmp一键安装包安装后,探针里测试邮件发送失败,Mail()函数及sendmail服务正常

  • A+
所属分类:LNMP

探针检查mail()函数正常,刚开始以为是iptables设置问题,关闭后未排除故障
检查sendmail是否安装,且运行状态是否正常

service sendmail status

显示正常如下:
sendmail (pid 29294) is running...
sm-client (pid 29303) is running...

如果你检查未发现服务则还未安装,centos请使用yum install sendmail安装先

mail()函数和sendmail服务都正常,不能发送邮件的原因,网上一查,没配置啊

配置php.ini,填写sendmail的绝对路径

vi /usr/local/php/etc/php.ini

查找命令

/sendmail_path

找到以下内容:

;sendmail_path =

去掉注释,修改为以下内容

sendmail_path = /usr/sbin/sendmail -t -i

:wq保存退出

重启php-fpm进程

/etc/init.d/php-fpm restart

再去探针里试试,可以发邮件了

附几个sendmail常用管理命令
/etc/init.d/sendmail start (启动sendmail)
/etc/init.d/sendmail stop (关闭sendmail)
/etc/init.d/sendmail restart (重启sendmail)

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: