|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40139 Mail command not returning true on success
Submitted: 2007-01-15 20:31 UTC Modified: 2007-01-30 01:00 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: sab2002a at yahoo dot com Assigned:
Status: No Feedback Package: Mail related
PHP Version: 4.4.4 OS: FreeBSD 5.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
50 - 16 = ?
Subscribe to this entry?

 [2007-01-15 20:31 UTC] sab2002a at yahoo dot com
I have PHP setup as a CGI and am using qmail as my mail server.

When I use the mail() function, on success, I do not get a true return on the function. I get no return.

On failure, I do get a false return.

Reproduce code:
if (!mail('','test','test','From:'))
echo "An error occurred";
echo "no error occurred";

Expected result:
Expect to see "no error occurred" and email sent.

Actual result:
The email gets sent but I get a "An error occurred" message.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-15 20:40 UTC]
Set display_errors to On and error_reporting to E_ALL.
 [2007-01-16 19:20 UTC] sab2002a at yahoo dot com
I set error reporting and display errors on to max and still the same thing.

I don't receive any error messages.
 [2007-01-16 21:17 UTC]
ini_set("display_errors", 1);
 [2007-01-19 17:05 UTC] sab2002a at yahoo dot com
Yes, that's what I did as per my previous comment.

No errors at all, email gets sent, and I get a "An error occurred" message.
 [2007-01-19 17:14 UTC]
Please try using this CVS snapshot:
For Windows:

Cannot reproduce.
 [2007-01-20 19:47 UTC] sab2002a at yahoo dot com
Still the same thing.

Here's the code:

ini_set("display_errors", 1);
if (!mail('','test','test','From:'))
echo "An error occurred";
echo "no error occurred";

The mail gets delivered and I still get "An error occurred" as the output with nothing else.

I'm thinking it may be something to do with the way I'm configuring/compiling.

Here's my configure line:
./configure --with-openssl --enable-calendar --with-curl --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-ttf --with-freetype-dir --with-t1lib --enable-gd-native-ttf --with-gettext --with-gmp --with-iconv --with-mcal --with-mcrypt --with-mhash --with-mime-magic --with-mysql --with-mysql-lib --with-ncurses --enable-pcntl --with-jpeg-dir --with-png-dir --with-zlib-dir --with-tiff-dir --with-pspell --with-mm --enable-sysvsem --enable-sysvmsg --enable-sysvshm --with-xmlrpc --with-iconv-dir --enable-xslt --with-xslt-sablot --with-iconv-dir --with-pear --enable-zend-multibyte --enable-sockets --enable-pcntl --enable-sigchild --enable-libgcc --enable-trans-sid --enable-ftp --with-config-file-path=/usr/local/lib --prefix=/usr/local/php --with-config-file-path=/usr/local/php --disable-cli --enable-force-cgi-redirect --enable-cgi --enable-mbstring
 [2007-01-22 07:17 UTC]
We are still unable to reproduce it.
 [2007-01-22 18:32 UTC] sab2002a at yahoo dot com
Some more info...

This is what I have under mail in my php.ini

[mail function]
SMTP                    =       localhost                       ;for win32 only
sendmail_from   =        ;for win32 only
sendmail_path =  /var/qmail/bin/qmail-inject

Also, I'm running netqmail 1.05 with a bunch of patches (spam, virus checking, etc).
 [2007-01-22 20:14 UTC]
Please provide an account @ this machine.
 [2007-01-30 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, 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".
 [2007-04-13 00:41 UTC] geoffwa at cs dot rmit dot edu dot au
This looks like a duplicate of bug #38342

Do you need --enable-sigchild for a particular reason?
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 07:01:27 2024 UTC