天天看点

解决PHP邮件一直不能发送的问题

apache的日志提示

email send error: Could not instantiate mail function

mail日志提示:

NOQUEUE: SYSERR(apache): /etc/mail/sendmail.cf: line 0: cannot open: Permission denied
           

google发现是SElinux的安全机制导致

evealed that the issue was caused by SELinux.

Running: getsebool httpd_can_sendmail returns off, which means that Apache (httpd) doesn’t have permission to send emails.

The issue was resolved by running:

setsebool -P httpd_can_sendmail on