diff -r 000000000000 -r 7f95f8617b0b vendor/swiftmailer/lib/classes/Swift/Mailer.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/swiftmailer/lib/classes/Swift/Mailer.php Sat Sep 24 15:40:41 2011 +0200 @@ -0,0 +1,118 @@ +_transport = $transport; + } + + /** + * Create a new Mailer instance. + * + * @param Swift_Transport $transport + * @return Swift_Mailer + */ + public static function newInstance(Swift_Transport $transport) + { + return new self($transport); + } + + /** + * Create a new class instance of one if the message services + * For example 'mimepart' would create a 'message.mimepart' instance + * + * @param string $service + * @return object + */ + public function createMessage($service = 'message') + { + return Swift_DependencyContainer::getInstance() + ->lookup('message.'.$service); + } + + /** + * Send the given Message like it would be sent in a mail client. + * + * All recipients (with the exception of Bcc) will be able to see the other + * recipients this message was sent to. + * + * Recipient/sender data will be retreived from the Message object. + * + * The return value is the number of recipients who were accepted for + * delivery. + * + * @param Swift_Mime_Message $message + * @param array &$failedRecipients, optional + * @return int + */ + public function send(Swift_Mime_Message $message, &$failedRecipients = null) + { + $failedRecipients = (array) $failedRecipients; + + if (!$this->_transport->isStarted()) + { + $this->_transport->start(); + } + + $sent = 0; + + try + { + $sent = $this->_transport->send($message, $failedRecipients); + } + catch (Swift_RfcComplianceException $e) + { + foreach ($message->getTo() as $address => $name) + { + $failedRecipients[] = $address; + } + } + + return $sent; + } + + /** + * Register a plugin using a known unique key (e.g. myPlugin). + * + * @param Swift_Events_EventListener $plugin + * @param string $key + */ + public function registerPlugin(Swift_Events_EventListener $plugin) + { + $this->_transport->registerPlugin($plugin); + } + + /** + * The Transport used to send messages. + * @return Swift_Transport + */ + public function getTransport() + { + return $this->_transport; + } +}