From 9eeded33f68872515954a2fc177fcb47a9273ae9 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 15 Aug 2014 17:23:41 -0700 Subject: Add email notifications --- .../classes/Swift/Transport/FailoverTransport.php | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php (limited to 'vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php') diff --git a/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php b/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php new file mode 100644 index 00000000..020bd057 --- /dev/null +++ b/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php @@ -0,0 +1,86 @@ +_transports); + $sent = 0; + + for ($i = 0; $i < $maxTransports + && $transport = $this->_getNextTransport(); ++$i) + { + try { + if (!$transport->isStarted()) { + $transport->start(); + } + + return $transport->send($message, $failedRecipients); + } catch (Swift_TransportException $e) { + $this->_killCurrentTransport(); + } + } + + if (count($this->_transports) == 0) { + throw new Swift_TransportException( + 'All Transports in FailoverTransport failed, or no Transports available' + ); + } + + return $sent; + } + + protected function _getNextTransport() + { + if (!isset($this->_currentTransport)) { + $this->_currentTransport = parent::_getNextTransport(); + } + + return $this->_currentTransport; + } + + protected function _killCurrentTransport() + { + $this->_currentTransport = null; + parent::_killCurrentTransport(); + } +} -- cgit v1.2.3