ZF-10249: Missing inclusion of SMTP status code in Zend_Mail_Protocol_Exception
Description
I asked this month before but never received a satisfying answers:
If I Use a Zend_Mail_Transport_Smtp for mail transport. How could I receive the Status code returned by the server on any errors.
Example: 451 greylisted - try again later
The Zend_Mail_Protocol_Exception only contains the "greylisted - try again later" which may vary between servers. The getCode() Method only returns 0.
To me this is a bug of the Zend_Mail_Transport_Smtp and I can't believe that noone else had this problem before.
Comments
Posted by Eutychus (eutychus) on 2010-07-30T05:43:41.000+0000
Maybe it could be possible to modify Zend_Mail_Protocol_Abstract::_expect() to submit servers response code via Exception code (which should solve my problem):
{color:red} $errCode = 0;{color} do { $this->_response[] = $result = $this->_receive($timeout); list($cmd, $more, $msg) = preg_split('/([\s-]+)/', $result, 2, PREG_SPLIT_DELIM_CAPTURE);
} while (strpos($more, '-') === 0);
if ($errMsg !== '') { /** * @see Zend_Mail_Protocol_Exception */ require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception($errMsg{color:red}, $errCode{color}); }
Posted by Marc Hodgins (mjh_ca) on 2010-11-24T10:09:08.000+0000
Thanks for the bug report. Addressed this in the patch attached to ZF-10741 as it was necessary to have access to the SMTP status codes for the unit tests on ZF-10741.
Posted by Marc Hodgins (mjh_ca) on 2010-11-24T10:09:20.000+0000
Closing this ticket as duplicate for now and linking to ZF-10741 for resolution.