Re: Net_SMTP - deadlock / robustness

From: Date: Thu, 30 Dec 2004 08:24:09 +0000
Subject: Re: Net_SMTP - deadlock / robustness
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-35271@lists.php.net to get a copy of this message
On Mon, Dec 20, 2004 at 04:12:01PM +0100, Matthias Pigulla wrote: > a certain remote MTA/SMTP server behaviour (actually, qmail) may cause > the SMTP connection to hang in a deadlock state. For postfix it deadlocks when $smtp->rcptTo("broken@host.name \r\nbroken@host.name"); is substituted with: $smtp->rcptTo("broken@host.name> \r\nbroken@host.name"); There is an alternative (esmtp PECL package): <?php if (!extension_loaded("esmtp")) dl('esmtp.so'); $host = 'localhost:25'; $from = "some@email.address"; $subj = "Subject: Test Message\n"; $body = "Body Line 1\nBody Line 2"; $session = new Esmtp_Session(); $message = $session->add_message(); $session->set_server ($host); $message->set_reverse_path ($from); $message->set_message_str ($subj . "\r\n" . $body); $rcpt = "broken@host.name> \r\nbroken@host.name"; $recipient = $message->add_recipient ($rcpt); $recipient->dsn_set_notify ( NOTIFY_SUCCESS|NOTIFY_FAILURE ); if (!$session->start_session ()) { echo "SMTP server problem: " . esmtp_strerror (esmtp_errno ()) . "\n"; } else { $status = $message->transfer_status(); echo $status['code'] . " " . $status['text'] . "\n"; } ?> For broken recipient it displays a message: 502 Error: command not implemented and communication with the server is: write(7, 0x00403CF0, 54) = 54 R C P T T O : < b r o k e n @ h o s t . n a m e > \r\n b r o k e n @ h o s t . n a m e >\r\n D A T A\r\n read(7, 0x004034E8, 2048) = 44 2 5 0 O k\r\n 5 0 2 E r r o r : c o m m a n d n o t i m p l e m e n t e d\r\n write(7, " Q U I T\r\n", 6) = 6 read(7, 0x004034E8, 2048) = 37 3 5 4 E n d d a t a w i t h < C R > < L F > . < C R > < L F >\r\n close(7) = 0 write(1, 0x003FF970, 37) = 37 5 0 2 E r r o r : c o m m a n d n o t i m p l e m e n t e d\r\n\n close(4) = 0 close(5) = 0 close(6) = 0 <esmtp advertisement> esmtp PHP package (libesmtp C library wrapper) is available from http://pecl.php.net/package/esmtp It works with PHP4 and PHP5. </esmtp advertisement> Best regards, -- Piotr Klaban

« previous php.pear.dev (#35271) next »