Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Does your mail fail with no errors?


2 replies to this topic

#1 mshallop

  • Community Member
  • 11 posts
  • Real Name:Micheal Shallop
  • Location:San Jose, CA

Posted 02 August 2005, 18:37

On some servers, mine included and I'm not the only one who experienced this problem according to the posts I've read, mail is not being sent off the server.

Simple php scripts fail to send mail and the mail() function consistently returns false. (A simple test script to install is included at the end of this post.) When you look at the error logs in /var/log, you can't find anything that indicates why your mail is failing.

On my server, this is what (basically) I have: Suse 9.3Pro, SendMail, Apache2, PHP4, and sending mail was failing with the appearance that php->mail() was never passing the arguments of the mail function to the sendmail application.

SOLUTION
You probably have one of the two following lines in your /etc/php.ini file:

sendmail_path =
or
sendmail_path = '/usr/sbin/sendmail -t -i'

What you need to do is change the sendmail path to:

sendmail_path = "/usr/sbin/sendmail -t -i"
(note the double quotes replacing the single quotes)

Stop and restart your Apache server so the new php.ini values are read. You should be good to go after this.

Hope this helps someone - I spent a couple of days knocking my head against the desk trying to figure out this one. Sometimes, it's the simple solutions that really throw you for a loop.

--Mike



<?php
$ret = "";
if (!function_exists("mail"))
die("mail() does not exist on this server.");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</HEAD>
<BODY>
<?php
echo "\$ret = mail(\"foo@bar.com\", \"testing php->email\", \"this is a test\", \"-f root@bar.com\");";
$ret = mail("foo@bar.com", "testing php->email", "this is a test", "-f root@bar.com");
echo "<BR/>mail() returned: " . ($ret? "TRUE" : "FALSE") . "<BR/>";
?>
</BODY>
</HTML>

Edited by mshallop, 02 August 2005, 18:39.


#2 MoisesZaragoza

  • Community Member
  • 894 posts
  • Real Name:Moises Zaragoza
  • Gender:Male
  • Location:Ft Lauderdale

Posted 02 August 2005, 19:09

Thanks for the help
at the end of the day the code will be good

#3 johnpan

  • Community Member
  • 9 posts
  • Real Name:johnnakis

Posted 01 October 2009, 09:18

What if osc fails to send email without ANY errors?
I tried the contribution email_test.php and it sends emails both with mail() and tep_mail() BUT the store cannot send any emails.
The email options in the admin panel are OK. (sendmail - lf- false - false - true)

What else should I look for?
Thanks