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?: <?php function bytesleft($fp) { $status = socket_get_status($fp); $bytes = $status['unread_bytes']; return $bytes; } function sendtext($str) { global $fp; echo $str; flush(); fwrite($fp, $str); $ret = fread($fp, 1); $ret.= fread($fp, bytesleft($fp)); return $ret; } $fp = false; if ($fp = fsockopen('relay.plus.net', 25, $errno, $errstr, 1)) { socket_set_timeout($fp, 1); $hash = md5(uniqid(rand())); echo sendtext("HELO server\r\n"); echo sendtext("MAIL FROM: [EMAIL PROTECTED]"); echo sendtext("RCPT TO: [EMAIL PROTECTED]"); echo sendtext("DATA\r\n"); echo sendtext("From: Matt Beale <[EMAIL PROTECTED]>\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 <machinename> 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