If you’re using SELinux, it’s its fault.
To check:
#getsebool -a | grep mail
If you find this turned off:
httpd_can_sendmail –> on
Just permanently add the expection with:
#setsebool -P httpd_can_sendmail 1
If you’re using postfix instead of sendmail:
In your php.ini, comment out the “sendmail_path” and add this:
sendmail_path = /usr/sbin/sendmail.postfix -t -i