07 Sep 2010 
Support Center » Knowledgebase » PHP Mail function not working (Linux)
 PHP Mail function not working (Linux)
Solution If you are having issues where it appears that the PHP Mail function is not working, there are a few things to check. 1) Is the issue with PHP itself... To test this, add the following code to a new php page on a website that is upon the server. Once uploaded, navigate to it on the site, and enter an email address when prompted. *******Enter Code between the stars *********** PHP Mail() test This form will attempt to send a test email. Please enter where this test should be sent to

Enter an email address:

\n"; if(mail($mail_to, $mail_subject, $mail_body,$header)) { print "Email sent successfully!"; } else { print "Email did not send"; } } ?> **************************************** If the mail function is working you will receive a successfully sent messagae, and of course an email. This shows that the error is within your script. If the email fails to be sent, check point 2 below. 2) Ensure that the server is configured to allow php to send email. To do this navigate to your php.ini file, locate at: - /etc/php5(or4)/apache2/php.ini Then find the value sendmail_path = If this is commented out as indicated here: - ;sendmail_path = Simply change the line to: - sendmail_path = /usr/sbin/sendmail -t Be sure to remove the semi colon to bring the line into play, and then save the file. If after the above changes the emails will still not be sent, then report the issue to a member of support who will take a more detailed look for you.

Article Details
Article ID: 48
Created On: 17 Apr 2009 08:14 PM

 Login [Lost Password] 
Email:
Password:
Remember Me:
 
 Search
 Article Options
Home | Knowledgebase | Downloads
Language:

Help Desk Software By Kayako eSupport v3.11.01