我无法从 php 脚本发送邮件,尽管我可以使用 sendmail 从命令行发送邮件,
php 发送邮件.php
我已经试过了
httpd 以 apache 用户身份运行,我将 apache 用户添加到 smmsp 组
httpd_can_sendmail --> 上
-
SELinux status: enabled SELinuxfs mount: /selinux Current mode: permissive Mode from config file: enforcing Policy version: 24 Policy from config file: targeted
但是在httpd error_log 中仍然显示这个错误
sh: /usr/sbin/sendmail: Permission denied
任何人都可以知道吗?我真的很感谢你的所有建议,并且真的对这个建议感到筋疲力尽。
最佳答案
您可以从命令行发送电子邮件并不意味着任何用户都可以(例如 apache)。
检查 apache 是否真的可以发送电子邮件:
sudo -u apache sendmail root@localhost
阅读邮件日志文件(通常是/var/log/mail.log)看看发生了什么。 root 的收件箱通常在/var/spool/mail/root )。提示:如果您不想将 root 用作小白鼠,请使用不同于 root 的其他用户。
关于php - 发送邮件 sh :/usr/sbin/sendmail: Permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9062127/