#43348 [Com]: Mail function returns true but no email sent

From: Date: Tue, 04 Dec 2007 15:54:43 +0000
Subject: #43348 [Com]: Mail function returns true but no email sent
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120365@lists.php.net to get a copy of this message
 ID:               43348
 Comment by:       pipaff at comptrio dot com
 Reported By:      RQuadling at GMail dot com
 Status:           Assigned
 Bug Type:         Mail related
 Operating System: Windows XP SP2
 PHP Version:      5.3CVS-2007-11-20 (snap)
 Assigned To:      johannes
 New Comment:

Update: Switched back to CGI and mail works again... lost the ability
to 'except users' from safe_mode in Apache config
(php_admin_value/flag), but mail works.

This is on a Linux box CentOS4... 2.6.9 kernel


Previous Comments:
------------------------------------------------------------------------

[2007-12-04 08:44:57] pipaff at comptrio dot com

The title caught my eye right away...

PHP 5.2.4 as DSO fails to work properly (Apache 2.0.61)

$mail = mail("admin@recipient.com","test","test inside","From:
webmaster@sender.com");
if($mail){
print "true";
}else{
print"false";
}


Expected: "true" and an email to be received (or false without email)

Actual: "true", but no email received, no error message/log, no record
in MTA (exim)


Recently Changed: CGI to DSO, same code worked prior using same
PHP/Apache version

------------------------------------------------------------------------

[2007-11-20 17:04:54] RQuadling at GMail dot com

====C:\testmail.php====
<?php
ini_set('SMTP', 'gmail-smtp-in.l.google.com'); // Force GMail to be the
server.
$s_Email = 'RQuadling' . '@' . 'GMail.com';
var_dump(mail($s_Email, PHP_VERSION, 'Your message',
"From:$s_Email"));
?>

and then

C:\PHP4\PHP -n C:\testmail.php
I get 4.4.7-dev message

C:\PHP5\PHP -n C:\testmail.php
I get nothing.

V:\PHP5.2.2RC2-dev\PHP -n C:\testmail.php
I get 5.2.2RC2-dev message

Today, we made a change from McAfee AV to Symantec AV. I am getting
little alerts for PHP4 and the PHP5.2.2 messages going out, but nothing
for PHP5.3.0-dev

------------------------------------------------------------------------

[2007-11-20 16:46:56] jani@php.net

It's pretty interesting since nothing has changed in this code between
those versions. And using the older one with exactly same line works?

------------------------------------------------------------------------

[2007-11-20 14:58:47] RQuadling at GMail dot com

Description:
------------
Same script working on 

PHP 4.4.7-dev (cgi-fcgi) (built: Mar 25 2007 21:02:43)
PHP 5.2.2RC2-dev (cli) (built: Apr 18 2007 08:03:01)

but not on 

PHP 5.3.0-dev (cli) (built: Nov 20 2007 08:19:12)

Using Wireshark to see SMTP activity.

No errors, warnings or notices produced.

Script doesn't crash.

True is returned.

Running via the command line to remove all extensions and relying on
default configuration.

Obviously, you will need to change the SMTP server and email addresses
to see this in operation.


Reproduce code:
---------------
php -n -r "ini_set('SMTP', 'gmail-smtp-in.l.google.com');
var_dump(mail('RQuadling@GeeWhizzMail.com', 'Subject', 'Message',
'From:RQuadling@GeeWhizzMail.com'));"


Expected result:
----------------
True AND an email to be received.

Actual result:
--------------
True but no SMTP activity when monitored using WireShark.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43348&edit=1


Thread (17 messages)

« previous php.bugs (#120365) next »