CentOS : Can’t send outbound message?

After installing Centos and Sendmail , you can’t send mail from PHP , you might have a warning ” can not initial mail function ” from php page


Centos 5 has SELinux enabled by default. Use the command getenforce to determine whether or not SELinux is enabled.

If SELinux is enabled you need to change the security settings for the web server. By default the web server daemon and any scripts it runs can’t make any network connections, and you need one to send e-mail.

Depending on the mechanism used by Horde enabling mail functionality may be sufficient:

setsebool httpd_can_sendmail=on
or you need to allow more general network access.

setsebool httpd_can_network_connect=on