[BUGFIX] Autoloader Cache is not updated
[Packages/TYPO3.CMS.git] / t3lib / mail / class.t3lib_mail_mailer.php
index e2c73f3..815d978 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2010 Ernesto Baschny <ernst@cron-it.de>
+ *  (c) 2010-2011 Ernesto Baschny <ernst@cron-it.de>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -35,8 +35,6 @@ require_once(PATH_typo3 . 'contrib/swiftmailer/swift_required.php');
  * This will use the setting in TYPO3_CONF_VARS to choose the correct transport
  * for it to work out-of-the-box.
  *
- * $Id$
- *
  * @author     Ernesto Baschny <ernst@cron-it.de>
  * @package TYPO3
  * @subpackage t3lib
@@ -71,7 +69,7 @@ class t3lib_mail_Mailer extends Swift_Mailer {
         * Prepares a transport using the TYPO3_CONF_VARS configuration
         *
         * Used options:
-        * $TYPO3_CONF_VARS['MAIL']['transport'] = 'smtp' | 'sendmail' | 'mail'
+        * $TYPO3_CONF_VARS['MAIL']['transport'] = 'smtp' | 'sendmail' | 'mail' | 'mbox'
         *
         * $TYPO3_CONF_VARS['MAIL']['transport_smtp_server'] = 'smtp.example.org';
         * $TYPO3_CONF_VARS['MAIL']['transport_smtp_port'] = '25';
@@ -99,7 +97,7 @@ class t3lib_mail_Mailer extends Swift_Mailer {
                                if ($port === '') {
                                        $port = '25';
                                }
-                               $useEncryption = ($mailSettings['transport_smtp_encrypt'] ? TRUE : FALSE);
+                               $useEncryption = ($mailSettings['transport_smtp_encrypt'] ? $mailSettings['transport_smtp_encrypt'] : NULL);
 
                                        // Create our transport
                                $this->transport = Swift_SmtpTransport::newInstance($host, $port, $useEncryption);
@@ -127,6 +125,15 @@ class t3lib_mail_Mailer extends Swift_Mailer {
                                $this->transport = Swift_SendmailTransport::newInstance($sendmailCommand);
                                break;
 
+                       case 'mbox':
+                               $mboxFile = $mailSettings['transport_mbox_file'];
+                               if ($mboxFile == '') {
+                                       throw new t3lib_exception('$TYPO3_CONF_VARS[\'MAIL\'][\'transport_mbox_file\'] needs to be set when transport is set to "mbox"', 1294586645);
+                               }
+                                       // Create our transport
+                               $this->transport = t3lib_div::makeInstance('t3lib_mail_mboxtransport', $mboxFile);
+                               break;
+
                        case 'mail':
                        default:
                                        // Create the transport, no configuration required
@@ -138,8 +145,8 @@ class t3lib_mail_Mailer extends Swift_Mailer {
 
 }
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_mailer.php']) {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_mailer.php']);
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_mailer.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_mailer.php']);
 }
 
 ?>
\ No newline at end of file