Zend\Mail contains some issues for connection handling; generally most people will not run into this unless they utilize the SMTP transport in say a worker from a message queue. Take the scenario of your worker runs out of work and disconnects from the SMTP server; if you go to send the mail again (without manually handling all connection semantics) it will fail. Further, there is a bug where it attempts to lazily load the connection but if there is already a connection object it doesn't check the state.
There are no BC breaks
The unit test asset for the SMTP protocol spy was not in good shape itself; it did not properly call many methods that it was extending from. A new method is in the Smtp protocol called hasSession which contains the variable from our start session and stop session code.
Additionally the Smtp transport now checks for the existence of the connection object and the new hasSession status. The code has been slightly refactored to keep BC but also to keep code duplication down.
Fixed an issue where disconnecting caused issues with send reinstanci…
…ating the connection
Merge branch 'hotfix/3561' into develop