|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1998-06-10 19:19 UTC] rasmus
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 08:00:01 2025 UTC |
The mail() function fails in 3.0. The bug is that recipients are not specified. I've tested this under Linux (with qmail) and Solaris (with sendmail). The test script is simply <? mail ($somevalidaddress, "ping", "you'll never see this"); ?> My most recent proof of the bug can be seen in the following shell transcript (from SunOS 5.5.1): > cat zmailtest.php3 #!/usr/local/bin/php3 -q <? echo "Working...\n"; mail ("matt@debris.com", "ping from 3.0", "nada") or die ("mail error"); echo "done"; ?> > ./zmailtest.php3 Working... mcglynn... Recipient names must be specified Saving message in /home/mcglynn/dead.letter /home/mcglynn/dead.letter... Can't create output: Operation not permitted done> (I don't know why it can't create the dead.letter output but the error message indicates that no recipients were defined.) The background on this can be found in my post to the PHP3 list, included here, and my later post to PHP3-DEV (also below). msg originally sent 6/9/98 to php3@lists.php.net: ------------------------------------------------ I built standalone CGIs of 3.0 and RC3 on a Linux system: Linux ns 2.0.32 #4 Wed Dec 31 11:39:15 PST 1997 i486 unknown Using two simple scripts that are identical except for the version of the PHP3 CGI they invoke, I've discovered that the full 3.0 release seems to have an error in its mail() function. The two scripts generate a mail to a remote host. I ran the two scripts one after another and only one mail appeared. Here are the relevant log lines: Jun 9 19:05:26 me qmail: 897444326.332762 new msg 56066 Jun 9 19:05:26 me qmail: 897444326.333788 info msg 56066: bytes 264 from <mcglynn@xx.yy.zz> qp 12205 uid 1000 Jun 9 19:05:26 me qmail: 897444326.402506 end msg 56066 Jun 9 19:05:32 me qmail: 897444332.624872 new msg 56066 Jun 9 19:05:32 me qmail: 897444332.625905 info msg 56066: bytes 266 from <mcglynn@xx.yy.zz> qp 12208 uid 1000 Jun 9 19:05:32 me qmail: 897444332.827715 starting delivery 1894: msg 56066 to remote matt@debris.com Jun 9 19:05:33 me qmail: 897444333.827335 delivery 1894: success: 207.21.175.30_accepted_message./Remote_host_said:_250_Message_received_OK/ Jun 9 19:05:33 me qmail: 897444333.887786 end msg 56066 In the second case, you can see qmail make the remote delivery (to matt@debris.com). In the first case, there is no delivery attempt at all. I would think this is a mail configuration error, but since RC3 is able to generate the mail, now I think that PHP is somehow truncating the recipients from the mail invocation (?). Here is the RC3 do-conf: ./configure --with-mysql --with-config-file-path=/home/httpd/apache/conf --enable-debug=no Here is the 3.0 do-conf: ./configure --with-gd=no --with-mysql --with-config-file-path=/home/httpd/apache/conf --enable-debug=no --enable-track-vars=yes Here is the relevant line from /home/httpd/apache/conf/php3.ini: sendmail_path=/var/qmail/bin/sendmail (/var/qmail/bin/sendmail is qmail's sendmail wrapper -- again, I know it works because RC3 doesn't have a problem) msg originally sent 6/10/98 to php-dev@php.iquest.net: ------------------------------------------------------ I'm following up on an anomaly that I reported to the PHP3 list last night. In a nutshell, the problem is this: I have two PHP3 standalone binaries (RC3 and 3.0 final). One can send mail; the other can't. In my post to the list yesterday I showed syslog lines that indicate that qmail makes no delivery attempt on the mail generated by the 3.0 final binary. Someone on the qmail list suggested that the mail was showing up with no recipients. Seems unlikely somehow, but I have anecdotal evidence that this may be the case: when I generate a mail message with no recipients on the command line, the syslog is the same as when the PHP3.0 binary generates mail. That is, there is no delivery attempt. I ran a diff against mail.c in RC3 and 3.0 and found that there were a lot of changes made. One stood out: fprintf(sendmail, "\n%s\n.\n", message); in RC3 became fprintf(sendmail, "\n%s\n", message); in 3.0. I noted in my syslog that the 3.0 mail was 2 bytes shorter, and I wondered if the trailing dot-newline was significant. (Seemed obvious that those were the two bytes that were missing.) So I made the change to 3.0 and recompiled, but alas, mail() still fails. So my query to you is this: how can I output or trap the data stream that PHP is sending to my mailer? Oh, BTW, php3.ini has defined sendmail as /var/qmail/bin/sendmail, which works (remember that RC3 can generate mail just fine). I'd like to dump the output of the mail() function to a terminal or text file somewhere so I can see if there's an obvious error -- like a missing newline in a critical place, or something. I don't know qmail well enough to know how to change its logging behavior or I'd pursue this there as well. I suppose I could just log this as a bug but I'd just as soon nail down a fix and implement it today if I can.