Nginx, PHP-FPM, SELinux and sendmail

Since I am a real master at forgiving things I am writing this one down.
PHP mail function relies on sendmail but SELinux by default block webservers from sending emails, the usual error that pop-out is:

sendmail[16328]: NOQUEUE: SYSERR(nginx): /etc/mail/ line 0: cannot open: Permission denied

Allow webservers to send email is as easy as editing the appropriate SELinux boolean:

setsebool -P httpd_can_sendmail 1

Use “sestatus” to check SELinux booleans:

sestatus -b | grep -i sendmail
look at the "About me" page.

Leave a Comment

Your email address will not be published. Required fields are marked *