If you’re using SendMail in Linux and have SELinux installed, you may find emails are not being sent. More specifically, you may notice errors appearing in your /var/log/httpd/error_log file:
chdir /var/spool/postfix: Permission denied
SELinux is known to cause unexpected behaviour with many server functions if the defaults are left configured – in this case, Apache doesn’t have SELinux permissions to send email through Postfix.
Check whether this really is the case by issuing the following command in a bash terminal:
The expected response will be (depending on the current setting):
httpd_can_sendmail --> (on|off)
If it is off, this can be changed to on by issuing:
sudo setsebool -P httpd_can_sendmail 1
-P in the command sets it to persist, which will retain your setting change when you reboot.