|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14032 Mail() always returns false but mail is sent
Submitted: 2001-11-12 09:39 UTC Modified: 2008-10-03 13:54 UTC
Avg. Score:4.2 ± 0.9
Reproduced:10 of 10 (100.0%)
Same Version:5 (50.0%)
Same OS:5 (50.0%)
From: tetranz at yahoo dot com Assigned:
Status: Closed Package: Mail related
PHP Version: 4.0.6 OS: FreeBSD 4.2
Private report: No CVE-ID: None
 [2001-11-12 09:39 UTC] tetranz at yahoo dot com
I can see that this has been reported for Solaris too.

mail() always returns false but mail is sent successfully.

I'm running PHP 4.0.6 as an Apache module on a FreeBSD virtual server host (at

sendmail version is 8.11.6

I can reproduce this with a simple script:

if (mail("","Test from PHP","Does this work?"))
	echo "True";
	echo "False";



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-06 15:47 UTC]
Works fine for me...It might be a FreeBSD prob..What mailer are you using?

 [2002-02-18 03:08 UTC] brett at mad dot scientist dot com
I'm seeing this same problem.  mail() always returns false (looks like a null string).  I'm also on FreeBSD with the same version of SendMail (8.11.6)
 [2002-03-07 00:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-07-03 08:37 UTC] scpark at gen128 dot com
I have same experience with my solaris box.

My machine is Ultra-60 server running Solaris 8.
PHP 4.2.1 and 4.1.2 occur same result.
Even mail() returns empty value, test mails are posted successfully.
Same code run on linux box, very well. No problem on linux.
 [2002-07-03 08:39 UTC] scpark at gen128 dot com
Oh! I forgot one thing.
My php is compiled as cgi. not mod_php.
 [2002-07-03 09:01 UTC] scpark at gen128 dot com
O.K. I hack php's mail.c little bit.
I added following code after pclose().
     fprintf(sendmail, "\n%s\n", message);
     ret = pclose(sendmail);
// start of debuging code
  php_error(E_WARNING, "%d,%d,%s", ret, errno, strerror(errno));
// end of debuging code
#ifdef PHP_WIN32
                if (ret == -1)

and php said

[03-Jul-2002 21:54:13] PHP Warning:  -1,10,No child processes in /web/ch2001/phpdocs/public/icard/test_post.php on line 11

Do you know what this mean?
 [2008-10-03 13:54 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 28 04:01:27 2024 UTC