Issues

ZF-9505: Zend_Mail_Protocol_Abstract - truncates server response when SMTP server responds with a message containing spaces

Description

When server response message contains spaces only the first "word" is retrieved.

Sample response to reproduce: 535 5.7.0 authentication failed

Expected error message: 5.7.0 authentication failed Actual error message: 5.7.0

The reason is using of string template for parsing server responses using sscanf (default: 3 digit code and response string) - '%d%s'. So, the function parses the response until the first space character is encountered.

Comments

Thank You for report, solved SVN r21634.

Perhaps this deprecation is unnecessary. Wouldn't the follow work just as well?

--- Mail/Protocol/Abstract.php (revision 21842) +++ Mail/Protocol/Abstract.php (working copy) @@ -107,7 +107,7 @@ * String template for parsing server responses using sscanf (default: 3 digit code and response string) * @var resource */ - protected $_template = '%d%s'; + protected $_template = '%d %[^$]s';

 /**

2 Jeff Clark Using '%d %[^$]s' doesn't cover cases when response contains hyphen after code (e.g 220-OK) used for multi-line responses.

Thank You, Jeff and Alex.

Zend_Mail_Protocol_Abstract should be able to handle multi-line SMTP response like as specified in ZF-8511.

So, The change of SVN r21634 would be better rather than modifing only $_template.