Description

h2. Bug Description

SMTP servers may respond to commands with multi-line responses. A response is not complete until a response message NOT prefixed by '-' is found. However, Zend_Mail_Protocol_Abstract throws an exception before reading the entire response, leading to a truncated error message being included in the exception and the object being left in an unusable state (when it could/should be left usable).

h2. Example multi-line SMTP response to an SMTP RCPT command

550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 http://mail.google.com/support/bin/… xxxxxxxxxx.xx

The _expect() method of Zend_Mail_Protocol_Abstract throws an exception upon encountering the first "550" line rather than reading the entire multi-line response before throwing the exception. This causes two problems:

(1) The exception thrown does not contain the full response from the SMTP server, making troubleshooting and logging difficult, and

(2) If the exception is caught, the protocol adapter remains in an unusable state because there are (in this case) three response lines trapped in the receive buffer. Subsequent attempts to issue commands (an SMTP RSET command, for example) will fail because the next call to _expect() will receive the "550-5.1.1 double-checking the recipient..." line from the buffer which does not make sense.

550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 http://mail.google.com/support/bin/…

h2. Actual output

550-5.1.1 The email account that you tried to reach does not exist. Please try