Apache CentOS 6 cannot send email and Drupal get HTTP request status fails
I’m installing a Pressflow 6 on a new machine running CentOS 6. I’m using Apache MPM Worker with FastCGI. Then I get the classical e-mail error:
Unable to send e-mail. Please contact the site administrator if the problem persists.
Then I try to use sendmail:
sendmail -v email@example.com < testmail
Where testmail is a file containing these lines:
Subject: test mail Ozu Yasujiro Ozu [blank line here]
And i get the message. PHP cannot send email through apache!
Trying a simple php script to send mail like drupal core do I got this error:
sendmail: fatal: chdir /var/spool/postfix: Permission denied
Then I check this variable following this awesome post:
# /usr/sbin/getsebool httpd_can_sendmail httpd_can_sendmail --> off
Enable httpd_can_sendmail solve this issue:
setsebool -P httpd_can_sendmail 1
And wait. It will be a long wait using the -P option. And then PHP and Drupal can send mail.
Then check again the variable:
# /usr/sbin/getsebool httpd_can_sendmail httpd_can_sendmail --> on
Now httpd can send mail. Try your script again.
The SMTP Authentication Support module is not working. This is another of these variables, the same that causes Drupal to show the “HTTP request status fails” message.
setsebool -P httpd_can_network_connect 1
And wait again. Both the SMTP module and the base Drupal networking are now working and Status report is all green.