ZF-8988: Zend Mail Transport SMTP set sender email address
File: /Zend/Mail/Transport/Smtp.php Line: 207
In the smtp transport the from address is set with the following function:
// Set sender email address $this->_connection->mail($this->_mail->getFrom());
When sending a mail to an unknown user with a valid host. In most cased the headers will be read and the Return-Path header will be used to return the mail.
When sending a mail to a non-existing host. The smtp server will return the mail to the from address given in the smpt transport. The header has not been read.
In my opinion the sender email address must be set with the following function, so the bounce addresses goes to the return path.
// Set sender email address $this->_connection->mail($this->_mail->getReturnPath());
Which automatically fallback in the from address if return path is not set.