#12335 [Com]: mail() function returns false but the email was sent.
| From: | teen-teen565 at hotmail dot com | Date: | Tue, 20 Jul 2004 15:11:23 +0000 |
| Subject: | #12335 [Com]: mail() function returns false but the email was sent. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63061@lists.php.net to get a copy of this message | ||
ID: 12335
Comment by: teen-teen565 at hotmail dot com
Reported By: sascha dot winkler at ks dot sel dot alcatel dot de
Status: Bogus
Bug Type: Mail related
Operating System: Sun Solaris 2.6
PHP Version: 4.1.2
New Comment:
<a href=http://adult-nastyfartsexi.da.ru>teen
teen</a>
Previous Comments:
------------------------------------------------------------------------
[2002-06-02 19:54:15] mfischer@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
------------------------------------------------------------------------
[2002-03-15 07:28:04] glen at designsolution dot co dot uk
More information:
Basically, the mail function was returning false even
though the email was being sent. Here is an example:
if ( mail( 'glen@designsolution.co.uk', 'test', 'test2',
"From: webmaster@$SERVER_NAME\r\nReply-To:
webmaster@$SERVER_NAME\r\nX-Mailer: PHP/" . phpversion(),
"-fstupid@webapproval.co.uk" ) ) {
echo "mail sent okay";
}
else {
echo "mail cannot be sent!";
}
The problem only occurs if you include the 5th parameter
and the -f email address is not set up on the local
machine. For example, PHP is running on the same machine
as the webapproval.co.uk domain. If the user 'stupid'
hasn't been set up, then sendmail will complain:
sendmail[21956]: JAA21956: setsender:
stupid@webapproval.co.uk: invalid or unparseable, received
from httpd@localhost
but will still send the mail. So essentially, sendmail is
returning an error code, but still sending the mail. The
return address is set to httpd@<my server address>.
------------------------------------------------------------------------
[2001-08-07 07:45:11] sascha dot winkler at ks dot sel dot alcatel dot
de
I found out, that the problem is not the EX_OK or EX_TEMPFAIL but the
sendmail return value.
Sendmail (the sendmail qmail wrapper) is returning the value -1 when I
call it with php 4.0.6.
When I call it with 4.0.4pl than 0 is returned.
What could be the reason for this behaviour?
------------------------------------------------------------------------
[2001-07-24 08:03:30] sascha dot winkler at ks dot sel dot alcatel dot
de
I had first the bug with id 12024 and I have fixed it like described in
the bug report.
Now I can send mails, but the mail() function returns false altough the
mail was sent.
I use the following script to test the mail() function.
<?php
$mail_to = "sascha.winkler@t-online.de";
$mail_subject = "PHP test mail() gesendet obwohl failed
gemeldet.";
$mail_body = " i hope that this mail() function works !
\n";
$mail_body .= " this is supposed to come on the second line
\n";
$mail_body .= " and this on the third line \n";
if (mail($mail_to, $mail_subject, $mail_body))
echo "Successfully sent the email \"$mail_subject\"
to $mail_to .";
else echo "Failed to send the e-mail \"$mail_subject\"." ;
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12335&edit=1