I was running a drupal 6.12 site on a CentOS system just fine. This is a pretty vanilla stock system with no additional modules other can core. I had to move the site to a fresh, new server running Fedora Core 10. Everything is working, except the contact page. When I try to send e-mail using that page, I get an error in the log stating "Error sending e-mail (from xxxx to xxxxx)."
I'm pretty sure it is hitting line 134 of mail.inc. drupal_mail_send() is returning an error because (I think) the php function mail() is returning an error.
There is nothing else reported in drupal's logs or php's log.
I'm sure this is because of something I had installed or configured in the original CentOS system (which I have neglected to do in the new FC10 system), but for the life of me, I don't remember what. I thought the php mail function worked pretty much out of the box.
I did crank up the max memory to 128M and turn on error logging in php.ini. I can send & receive mail just fine on the new server. I'm running postfix, if it matters.
Any help would be greatly appreciated!
Thanks,
Kory
Comments
Try mynetworks directive
Did you check mynetworks configuration in /etc/postfix/main.cf? (I use Ubuntu, location may differ) Sometimes it's also necessary to setup myhostname directive. A review of mail log may also be useful (/var/log/mail.log).
Regards,
Alex
Hi Alex, Thanks for the
Hi Alex,
Thanks for the reply. I solved the problem late last night (and forgot to update this thread -- my apologies). Its seems I needed to comment out the 'sendmail_path' setting in php.ini. I don't understand why, because it was correct, but I noticed it was also commented out on the original server (I did not configure that server). Once I commented it out and restarted httpd, I could then send mail with php.
Thanks,
Kory
Another potential reason for
Another potential reason for "Error sending e-mail" error messages on Fedora would be if SELinux is blocking the web server from sending emails.
If you're running Sendmail then check its logs (/var/mail/mailog) for signs of a problem and you might see something like
Snippet 1
NOQUEUE: SYSERR(apache) /etc/mail/sendmail.cf Permission deniedalso, running the following command with root permissions
Snippet 2
/usr/sbin/semanage boolean -l|grep sendmailmay show "httpd_can_sendmail off"
If both of the above are true then instruct SELinux to allow httpd to relay through Sendmail by running the following with root permissions
Snippet 3
/usr/sbin/setsebool -P httpd_can_sendmail onNote the -P option makes it permanent across reboots.
Running the code in Snippet 2 again should now show "httpd_can_sendmail on"
In my case it was not necessary to re-boot httpd or do anything else.