|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25862 mail() always return FALSE
Submitted: 2003-10-14 08:26 UTC Modified: 2003-10-14 17:53 UTC
Avg. Score:4.0 ± 1.0
Reproduced:9 of 9 (100.0%)
Same Version:1 (11.1%)
Same OS:2 (22.2%)
From: thouraud at bondy dot ird dot fr Assigned:
Status: Wont fix Package: Mail related
PHP Version: 4.3.3 OS: solaris 9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: thouraud at bondy dot ird dot fr
New email:
PHP Version: OS:


 [2003-10-14 08:26 UTC] thouraud at bondy dot ird dot fr
The mail() function always return FALSE.
Even if the mail is sent !

Test with the sun's sendmail and postfix 2.0.16.
The mail can go out with no problem.

The result get the same safe_mode or not.

apache 1.3.28 with php as a module

Reproduce code:
  $ret = mail ("user@domain.tld", 
               "sujet " . date("l dS of F Y h:i:s A"),
               "From: user@domain.tld\r\n"
               ."Reply-To: user@domain.tld\r\n"
              ) ;

  print "ret = $ret<hr>" ;
  if ($ret) {
    print 'OK<br>' ;
  } else {
    print 'KO<br>' ;


Expected result:
if we can send mail to user@domain.tld
then OK and user@domain.tld receive the mail.

if any error to sent mail 
then KO and no mail !

Actual result:
always KO

but the mail are been received !


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-14 10:34 UTC]
What was the configure line you used to configure PHP?

 [2003-10-14 10:44 UTC] thouraud at bondy dot ird dot fr
the configure line is :

./configure  --with-apxs=/opt/apache/bin/apxs --prefix=/opt/apache --with-config-file-path=/opt/apache/conf --with-mysql --disable-debug --enable-trans-sid --with-oci8=/opt/oracle/product/9201 --enable-dbase --enable-safe-mode --disable-magic-quotes --enable-sigchild --enable-ldap --with-zlib=/opt/sfwplus --enable-mbstring --enable-mbregex --enable-zend-multibyte --enable-bcmath --enable-calendar --enable-exif --with-jpeg-dir=/opt/sfwplus --with-png-dir=/opt/sfwplus --with-tiff-dir=/opt/sfwplus --with-gd --with-iconv --with-pgsql=/opt/postgres
 [2003-10-14 11:13 UTC]
Okay, try removing the --enable-sigchild configure option
and reconfigure/compile PHP. (don't forget to delete config.cache before reconfiguring!)

 [2003-10-14 13:05 UTC] thouraud at bondy dot ird dot fr
Without the --enable-sigchild configure option, it seems that mail() alwayes return TRUE.

Even if the mail server returns an "unknown error" with a false email, or an "No recipients specified" with a blank first field of mail().

Is that normal ? When mail() returns FALSE ?
 [2003-10-14 17:53 UTC]
When PHP is compiled with --enable-sigchild the return codes of executed programs are lost. Once of those programs is sendmail, since PHP cannot fetch the return code it assumes the program had failed. Hence the always FALSE return value of mail(). Normally mail() returns false only when communication between PHP & sendmail fails.
 [2004-05-06 04:07 UTC] roguedragon at merging dot org
PHP version 4.3.6 / Apache 1.3.29 on FreeBSD
Having the same problem listed here, but I recompiled php & apache without the --enable-sigchild flag, restarted everything, and mail() is still returning false even though the mail is going through correctly. Any suggestions?
 [2011-07-03 08:03 UTC] zhirkow at gmail dot com
still having this problem with php 5.2 on centos 5.6 x86
mail() return false with no reason or explaination of what happens. also nothing in logs...
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Nov 28 12:05:52 2022 UTC