Follow-up to #15998: let the Transport be configurable in the t3lib_mail_mailer const...
authorErnesto Baschny <ernst@cron-it.de>
Sun, 17 Oct 2010 09:59:17 +0000 (09:59 +0000)
committerErnesto Baschny <ernst@cron-it.de>
Sun, 17 Oct 2010 09:59:17 +0000 (09:59 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9124 709f56b5-9817-0410-a4d7-c38de5d9e867

t3lib/mail/class.t3lib_mail_mailer.php

index b755bbe..2cc4cd0 100644 (file)
@@ -51,13 +51,18 @@ class t3lib_mail_mailer extends Swift_Mailer {
        /**
         * When constructing, also initializes the Swift_Transport like configured
         *
+        * @param Swift_Transport optionally pass a transport to the constructor. By default the configured transport from $TYPO3_CONF_VARS is used
         * @throws t3lib_exception
         */
-       public function __construct() {
-               try {
-                       $this->initializeTransport();
-               } catch (Exception $e) {
-                       throw new t3lib_exception($e->getMessage());
+       public function __construct(Swift_Transport $transport = NULL) {
+               if ($transport !== NULL) {
+                       $this->transport = $transport;
+               } else {
+                       try {
+                               $this->initializeTransport();
+                       } catch (Exception $e) {
+                               throw new t3lib_exception($e->getMessage());
+                       }
                }
                parent::__construct($this->transport);
        }