Sendmail won't send emails on CentOS 7 (Permission denied)

Issue

Apache on CentOS 7 can't send emails via Sendmail. Website front-end displays following error:

Could not execute: /usr/sbin/sendmail

/var/log/maillog file shows following error:

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

Resolution

Quick 'sestatus' check revealed 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

02.2015
CentOS 7 LAMP server 



Newsletter

Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait
Privacy Policy