Portal Home > Knowledgebase > Articles Database > PHP mail() function not working
PHP mail() function not working
Posted by Zaggs, 12-10-2007, 10:28 AM |
Hi Guys,
I have just changed servers and uploaded a mail() script which was working on my previous config but does not work on the new server config. What is stopping the emails from being delivered, is there something new in WHM that I need to do?
Here are my WHM and cPanel details:
WHM 11.11.0 cPanel 11.15.0-R18264
REDHAT 4 i686 on standard - WHM X v3.1.0
Thanks in advance
|
Posted by activelobby4u, 12-10-2007, 03:57 PM |
what does your log files say ?. especially the exim_mainlog and the apache log files ?
|
Posted by arbet, 12-10-2007, 06:46 PM |
It could be that sendmail is not installed, or php.ini is pointing to the wrong path.
Check the sendmail_path directive in php.ini
|
Posted by ub3r, 12-10-2007, 07:19 PM |
Check your WHM settings and make sure 'disallow nobody user from sending email' is not selected.
|
Posted by david510, 12-10-2007, 08:46 PM |
Have a check of what ub3r said and test the server using the following simple php mail script.
|
Posted by Zaggs, 12-11-2007, 09:33 AM |
I don't think sendmail is installed as when I type 'rpm -q sendmail' it says 'package sendmail is not installed'.
How do I install it?
|
Posted by arbet, 12-11-2007, 09:48 AM |
login as root
yum install sendmail
|
Posted by Zaggs, 12-11-2007, 09:58 AM |
Ok I managed to install sendmail but the mails are still not working. Just tried the above mail() script too, but this does not work!
Is there anything else I need to configure?
|
Posted by arbet, 12-11-2007, 10:09 AM |
whereis sendmail"
make sure the sendmail_path directive is the same as the path you get from the above command and add to it the "-t" option.
Ex. if the path is /usr/bin/sendmail, then modify your php.ini file to have sendmail path = "/usr/bin/sendmail -t"
|
Posted by cPanelDavidG, 12-11-2007, 12:07 PM |
Sendmail is not installed on a cPanel/WHM server, however its functionality is emulated. All requests (EDIT: intended for) sendmail are routed through Exim.
Installing sendmail is a bad idea. At the very least, it is considered insecure.
Last edited by cPanelDavidG; 12-11-2007 at 12:08 PM.
Reason: Clarified that sendmail is emulated and not needed on a cPanel/WHM server to process sendmail requests.
|
Posted by cPanelDavidG, 12-11-2007, 12:09 PM |
Agreed, that's usually the first thing I recommend - especially on servers not running SuPHP.
Additionally, check the Exim mail queue to ensure things aren't winding up trapped in the mail queue somehow.
|
Posted by ub3r, 12-11-2007, 07:48 PM |
Sendmail is mostly just being used as a client on most systems. The actual connection goes from sendmail, to exim, out to the remote mail server.
Check your /var/log/exim_mainlog if the WHM setting checks out, and also make sure your server hostname is set to something valid. Also, try setting a sender address like so:
|
Posted by Tealeaf, 12-12-2007, 12:04 AM |
I suggest rebuild exim again. This will put in a new copy of sendmail at the same time.
|
Posted by Elmasry, 08-18-2008, 05:50 PM |
I got the suffering of the same problem and does not find a solution php scripts can not send any mail by PHP mail() function
any help plz?
|
Add to Favourites Print this Article
Also Read