zendframework/zf2 — pull request #3561 by mwillbanks (2013-01-25 18:14:22+00:00)
Title: Zend\Mail SMTP Fix Connection Handling

## Overview
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.

## Changes
_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.