Re: mail() not working correctly

From: Date: Mon, 26 Jun 2000 23:11:35 +0000
Subject: Re: mail() not working correctly
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3236@lists.php.net to get a copy of this message
On Mon, 26 Jun 2000 php@theOrb.net wrote: > mail() is not working correctly for me. This is what I've done: > > <? > $To = "php@theOrb.net"; > $Subject = "mail()"; > $mail = "This is a test."; > $From = "From: php@theOrb.net"; > > mail("$To", "$Subject", "$mail", "$From"); > ?> > > /var/log/maillog shows that it has been given something: > > ...from=nobody, size=72, class=0, pri=72, nrcpts=0, msgid=<...>, > relay=nobody@localhost > > server info: > > Linux RedHat 6.1 > sendmail 8.9.7 > apache 1.3.12 > php 4.0.0 (compiled into apache - not a dso) > > configuration info: > > apache running as user "nobody" > sendmail accepts relay from localhost.localdomain Man, this is just like the problem I just solved. Here's what fixed it for me (YMMV): Check your php.ini file. You should have a sendmail_path variable there. Two things: 1. make sure it points to the correct location of sendmail on your system (probably /usr/sbin/sendmail or /usr/lib/sendmail) 2. Make sure you include ALL the appropriate options (like -t) For example, myconfig says: sendmail_path = "/usr/lib/sendmail -t" For a while, it said sendmail_path = /usr/lib/sendmail And adding the -t (and the quotes :) made all the difference. It seems that PHP runs 'sendmail -t' by default, but when you specifiy a new sendmail path, it doesn't automatically attach the options. This seems obvious to me now, but it wasn't when I configured PHP. What tipped me of on mine was the 'nrcpts=0' in the maillog. I knew something was up when sendmail was properly sending email, just not to anyone in particular. :) Good luck. HTH. -- Don Faulkner, MCP | Senior Security Analyst | Spectria <don.faulkner@infosec.spectria.com> | --A division of Rainbow Technologies | 1-888-IS-GUARD

« previous php.general (#3236) next »