#22947 [Com]: mail function hang-up
ID: 22947 Comment by: lwillis at plus dot net Reported By: me at mattbeale dot plus dot com Status: Assigned Bug Type: Mail related Operating System: Windows 2000 SP4 PHP Version: 4CVS-2003-04-29 (stable) Assigned To: edink New Comment: As far as I can see from section 4.1.1.1 of RFC 2821 the response given to the HELO command is perfectly valid. http://www.faqs.org/rfcs/rfc2821.html The check for a space and then dash was introduced into win32/sendmail.c at version 1.20 with the following log entry: -- revision 1.20 date: 2000/09/05 00:26:15; author: sterling; state: Exp; lines: +5 -2 This should fix the multiple-line problem. -- Not sure which "multiple line problem" though - possibly bug 6537 Either way, the response we're sending looks like it should be handled fine by PHP - and it certainly shouldn't cause a hang (I expect PHP is waiting for more data trying to get the next line of a multi-line response - but it should be doing this as the response code (250) is followed by a space, not a dash ... Previous Comments: [2003-08-03 09:05:38] me at mattbeale dot plus dot com Does this not get acknowledgement unless the Status is set back to Open? [2003-08-02 18:28:51] phpbugs at pligplob dot com This does seem to be a fault in the Windows code, the Ack() function in sendmail.c: win32/sendmail.c(Ack): ... if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') || ... It is specifically disallowing SPACE HYPHEN at the end of the SMTP reply text that PlusNet's server is sending, but that seems to be allowed by RFC2821. However, since someone has deliberately blocked this pattern there must be a reason for it, but it seems invalid to me. When I modifed the php4ts.dll to use EHLO instead of HELO the SMTP exchange completed successfully. PlusNet's server avoids the "illegal" SPACE HYPHEN in its extended reply, so the hangup doesn't occur. [2003-07-30 15:39:46] me at mattbeale dot plus dot com In addition to my previous message: This PHP code works fine on both machines that have problems. I doubt I need to tell you what it does?: \r\n"); echo sendtext("Subject: [PHP] Test Subject - {$hash}\r\n"); echo sendtext("To: Matt Beale <[EMAIL PROTECTED]>\r\n"); echo sendtext("\r\n"); echo sendtext("This is a test message sent from PHP\r\n"); echo sendtext("\r\n"); echo sendtext("Hash: {$hash}\r\n"); echo sendtext(".\r\n"); echo sendtext("QUIT\r\n"); fclose($fp); } ?> If Andrew happens to read this, I'd be interested to know if it works for him. Plus I'd be very interested in what the PHP developers think might be going on. [2003-07-30 07:54:51] me at mattbeale dot plus dot com I wouldn't know what else to try and eliminate. I've tried two operating systems with different service packs and two methods of Internet Connection (Router and USB Modem). The only thing I can't change is my ISP. I can only conclude that there must be something 'up' with my ISPs mail server, but if that is the case why do I only get problems with PHP? Everything else works fine - I can send mail from Outlook/Outlook Express/Mozilla fine and I also use POPFile 0.19.1 on my server which has no problems with communicating with my ISPs mail server. If there were really problems with my ISPs mail server, wouldn't I experience similar problems in the other applications I use? [2003-07-30 02:05:33] [EMAIL PROTECTED] I can't reproduce this either, must be local problem to you only. (we'd have hundreds of reports about this if it really was a bug) The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22947 -- Edit this bug report at http://bugs.php.net/?id=22947&edit=1
#22947 [Com]: mail function hang-up
ID: 22947 Comment by: lwillis at plus dot net Reported By: me at mattbeale dot plus dot com Status: Assigned Bug Type: Mail related Operating System: Windows 2000 SP4 PHP Version: 4CVS-2003-04-29 (stable) Assigned To: edink New Comment: The patch below (I can't find anywhere to add this as an attachment - shoot me if I'm being stupid) may fix the problem (Matt - could you try it?). Not sure whether it will work correctly with multi-line responses. This is untested - I don't have access to a win32 platform to build on right now (Or a mail server that sends multi-line responses to a HELO ...) Index: win32/sendmail.c === RCS file: /repository/php-src/win32/sendmail.c,v retrieving revision 1.55 diff -u -r1.55 sendmail.c --- win32/sendmail.c23 Jul 2003 16:03:10 - 1.55 +++ win32/sendmail.c11 Aug 2003 10:10:54 - @@ -882,11 +882,10 @@ /* Check for newline */ Index += rlen; - if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') || + if ((buf[3] == '-') || (buf[Received - 2] != '\r') || (buf[Received - 1] != '\n')) /* err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); */ - goto again; /* Incomplete data. Line must be terminated by CRLF - And not contain a space followed by a '-' */ + goto again; /* Incomplete data OR multi-line response. Line must be terminated by CRLF */ if (buf[0] > '3') { /* If we've a valid pointer, return the SMTP server response so the error message contains more information */ Previous Comments: [2003-08-11 04:43:16] lwillis at plus dot net As far as I can see from section 4.1.1.1 of RFC 2821 the response given to the HELO command is perfectly valid. http://www.faqs.org/rfcs/rfc2821.html The check for a space and then dash was introduced into win32/sendmail.c at version 1.20 with the following log entry: -- revision 1.20 date: 2000/09/05 00:26:15; author: sterling; state: Exp; lines: +5 -2 This should fix the multiple-line problem. -- Not sure which "multiple line problem" though - possibly bug 6537 Either way, the response we're sending looks like it should be handled fine by PHP - and it certainly shouldn't cause a hang (I expect PHP is waiting for more data trying to get the next line of a multi-line response - but it should be doing this as the response code (250) is followed by a space, not a dash ... [2003-08-03 09:05:38] me at mattbeale dot plus dot com Does this not get acknowledgement unless the Status is set back to Open? [2003-08-02 18:28:51] phpbugs at pligplob dot com This does seem to be a fault in the Windows code, the Ack() function in sendmail.c: win32/sendmail.c(Ack): ... if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') || ... It is specifically disallowing SPACE HYPHEN at the end of the SMTP reply text that PlusNet's server is sending, but that seems to be allowed by RFC2821. However, since someone has deliberately blocked this pattern there must be a reason for it, but it seems invalid to me. When I modifed the php4ts.dll to use EHLO instead of HELO the SMTP exchange completed successfully. PlusNet's server avoids the "illegal" SPACE HYPHEN in its extended reply, so the hangup doesn't occur. [2003-07-30 15:39:46] me at mattbeale dot plus dot com In addition to my previous message: This PHP code works fine on both machines that have problems. I doubt I need to tell you what it does?: \r\n"); echo sendtext("Subject: [PHP] Test Subject - {$hash}\r\n"); echo sendtext("To: Matt Beale <[EMAIL PROTECTED]>\r\n"); echo sendtext("\r\n"); echo sendtext("This is a test message sent from PHP\r\n"); echo sendtext("\r\n"); echo sendtext("Hash: {$hash}\r\n"); echo sendtext(".\r\n"); echo sendtext("QUIT\r\n"); fclose($fp); } ?> If Andrew happens to read this, I'd be interested to know if it works for him. Plus I'd be very interested in what the PHP developers think might be going on. [2003-07-30 07:54:51] me at
#22947 [Com]: mail function hang-up
ID: 22947 Comment by: lwillis at plus dot net Reported By: me at mattbeale dot plus dot com Status: Assigned Bug Type: Mail related Operating System: Windows 2000 SP4 PHP Version: 4CVS-2003-04-29 (stable) Assigned To: edink New Comment: Probably easier to grab the patch from here: http://www.lwillis.plus.com/php_sendmail_patch.patch Lee Previous Comments: [2003-08-11 05:15:01] lwillis at plus dot net The patch below (I can't find anywhere to add this as an attachment - shoot me if I'm being stupid) may fix the problem (Matt - could you try it?). Not sure whether it will work correctly with multi-line responses. This is untested - I don't have access to a win32 platform to build on right now (Or a mail server that sends multi-line responses to a HELO ...) Index: win32/sendmail.c === RCS file: /repository/php-src/win32/sendmail.c,v retrieving revision 1.55 diff -u -r1.55 sendmail.c --- win32/sendmail.c23 Jul 2003 16:03:10 - 1.55 +++ win32/sendmail.c11 Aug 2003 10:10:54 - @@ -882,11 +882,10 @@ /* Check for newline */ Index += rlen; - if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') || + if ((buf[3] == '-') || (buf[Received - 2] != '\r') || (buf[Received - 1] != '\n')) /* err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); */ - goto again; /* Incomplete data. Line must be terminated by CRLF - And not contain a space followed by a '-' */ + goto again; /* Incomplete data OR multi-line response. Line must be terminated by CRLF */ if (buf[0] > '3') { /* If we've a valid pointer, return the SMTP server response so the error message contains more information */ [2003-08-11 04:43:16] lwillis at plus dot net As far as I can see from section 4.1.1.1 of RFC 2821 the response given to the HELO command is perfectly valid. http://www.faqs.org/rfcs/rfc2821.html The check for a space and then dash was introduced into win32/sendmail.c at version 1.20 with the following log entry: -- revision 1.20 date: 2000/09/05 00:26:15; author: sterling; state: Exp; lines: +5 -2 This should fix the multiple-line problem. -- Not sure which "multiple line problem" though - possibly bug 6537 Either way, the response we're sending looks like it should be handled fine by PHP - and it certainly shouldn't cause a hang (I expect PHP is waiting for more data trying to get the next line of a multi-line response - but it should be doing this as the response code (250) is followed by a space, not a dash ... [2003-08-03 09:05:38] me at mattbeale dot plus dot com Does this not get acknowledgement unless the Status is set back to Open? [2003-08-02 18:28:51] phpbugs at pligplob dot com This does seem to be a fault in the Windows code, the Ack() function in sendmail.c: win32/sendmail.c(Ack): ... if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') || ... It is specifically disallowing SPACE HYPHEN at the end of the SMTP reply text that PlusNet's server is sending, but that seems to be allowed by RFC2821. However, since someone has deliberately blocked this pattern there must be a reason for it, but it seems invalid to me. When I modifed the php4ts.dll to use EHLO instead of HELO the SMTP exchange completed successfully. PlusNet's server avoids the "illegal" SPACE HYPHEN in its extended reply, so the hangup doesn't occur. [2003-07-30 15:39:46] me at mattbeale dot plus dot com In addition to my previous message: This PHP code works fine on both machines that have problems. I doubt I need to tell you what it does?: \r\n"); echo sendtext("Subject: [PHP] Test Subject - {$hash}\r\n"); echo sendtext("To: Matt Beale <[EMAIL PROTECTED]>\r\n"); echo sendtext("\r\n"); echo sendtext("This is a test message sent from PHP\r\n"); echo sendtext("\r\n"); echo sendtext("Hash: {$hash}\r\n"); echo sendtext(".\r\n"); echo sendtext("QUIT\r\n"); fclose($fp); } ?> If Andrew happens to read this, I'd
#22947 [Com]: mail function hang-up
ID: 22947 Comment by: phpbugs at pligplob dot com Reported By: me at mattbeale dot plus dot com Status: Bogus Bug Type: Mail related Operating System: Windows 2000 SP4 PHP Version: 4CVS-2003-04-29 (stable) New Comment: This does seem to be a fault in the Windows code, the Ack() function in sendmail.c: win32/sendmail.c(Ack): ... if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') || ... It is specifically disallowing SPACE HYPHEN at the end of the SMTP reply text that PlusNet's server is sending, but that seems to be allowed by RFC2821. However, since someone has deliberately blocked this pattern there must be a reason for it, but it seems invalid to me. When I modifed the php4ts.dll to use EHLO instead of HELO the SMTP exchange completed successfully. PlusNet's server avoids the "illegal" SPACE HYPHEN in its extended reply, so the hangup doesn't occur. Previous Comments: [2003-07-30 15:39:46] me at mattbeale dot plus dot com In addition to my previous message: This PHP code works fine on both machines that have problems. I doubt I need to tell you what it does?: \r\n"); echo sendtext("Subject: [PHP] Test Subject - {$hash}\r\n"); echo sendtext("To: Matt Beale <[EMAIL PROTECTED]>\r\n"); echo sendtext("\r\n"); echo sendtext("This is a test message sent from PHP\r\n"); echo sendtext("\r\n"); echo sendtext("Hash: {$hash}\r\n"); echo sendtext(".\r\n"); echo sendtext("QUIT\r\n"); fclose($fp); } ?> If Andrew happens to read this, I'd be interested to know if it works for him. Plus I'd be very interested in what the PHP developers think might be going on. [2003-07-30 07:54:51] me at mattbeale dot plus dot com I wouldn't know what else to try and eliminate. I've tried two operating systems with different service packs and two methods of Internet Connection (Router and USB Modem). The only thing I can't change is my ISP. I can only conclude that there must be something 'up' with my ISPs mail server, but if that is the case why do I only get problems with PHP? Everything else works fine - I can send mail from Outlook/Outlook Express/Mozilla fine and I also use POPFile 0.19.1 on my server which has no problems with communicating with my ISPs mail server. If there were really problems with my ISPs mail server, wouldn't I experience similar problems in the other applications I use? [2003-07-30 02:05:33] [EMAIL PROTECTED] I can't reproduce this either, must be local problem to you only. (we'd have hundreds of reports about this if it really was a bug) [2003-07-29 16:05:54] me at mattbeale dot plus dot com There does appear to be a very slight change. PHP now appears to be replying to the server after the initial HELO command, but the reply always consists of just header and no data. I have created a second csv export which shows the changes if it is of any use: http://www.mattbeale.plus.com/phpbug22947/phpbug22957-4.3.3RC2.csv I have also tested this snapshot on my Windows XP machine, as well as on my Windows 2000 machine (which has now been upgraded to Service Pack 4) both running Apache 1.3.28 and the latest PHP snapshot and have also tried using a non-NAT connection via ye-olde-faithful Alcatel Speedtouch USB Modem rather than my DSL router, but the same problems still occur on both machines. [2003-07-29 12:58:22] [EMAIL PROTECTED] I can't replicate this on win98 with either 4.3.2-RC3-dev or 5.0.0b2-dev (though it's noticeably faster with PHP 5). Can someone on a later version of windows please test with a recent PHP snapshot and confirm whether there's still a problem? The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22947 -- Edit this bug report at http://bugs.php.net/?id=22947&edit=1
#22947 [Com]: mail function hang-up
ID: 22947 Comment by: andrew at pirionsystems dot com dot au Reported By: me at mattbeale dot plus dot com Status: Open Bug Type: Mail related Operating System: Windows 2000 SP3 PHP Version: 4CVS-2003-04-29 (stable) New Comment: The SMTP server doesn't appear to be relevent, nor the IP on which it is listening. I have this problem both with using the Microsoft SMTP service on localhost, or sendmail running on a smarthost system 1 hop away over 100Mbit ethernet. Previous Comments: [2003-04-29 09:57:43] me at mattbeale dot plus dot com No change. PHP still gets stuck in a never ending loop until I forcefully stop the Apache service. If it is of any use I have a csv export from a packet monitoring program which has all the raw header data that is being sent and received by PHP. http://www.mattbeale.plus.com/phpbug22947/phpbug22947.csv [2003-04-28 10:33:27] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip [2003-04-25 14:09:57] me at mattbeale dot plus dot com Just got a reply from my ISP. The mail software they use is Qmail. Hope that helps to resolve whatever the problem might be. [2003-04-24 17:26:07] me at mattbeale dot plus dot com I'm uncertain as to which SMTP server it is as there is no specific identification, but I have emailed someone I know who works for them to see if he can find out for me. If not, then I wouldnt know, sorry. [2003-04-23 04:29:34] [EMAIL PROTECTED] Which SMTP server is it? Seems like it's a problem with it if it hangs.. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22947 -- Edit this bug report at http://bugs.php.net/?id=22947&edit=1