/** * Class destructor to ensure all open connections are closed */ public function __destruct() { if ($this->connection instanceof Protocol\Smtp) { try { $this->connection->quit(); } catch (ProtocolException\ExceptionInterface $e) { // ignore } if ($this->autoDisconnect) { $this->connection->disconnect(); } } }