The SELinux is the culprit! You need to enable the sending of emails from one of its Boolean values ​​to allow you to send these emails.
It works at the Kernel level and is a MAC (Mandatory access control).

Permission Denied While Trying

If you execute the command:

getsebool -a

You will have a list of values. There is a value called:


I was off! In order to make certain changes in the permissions of some applications the SELinux “turned off” that possibility. When we discovered it, we found a way to solve it:

setsebool -P httpd_can_sendmail on

Thanks to “hedicode” for the fix.