18 require_once PATH_typo3 .
'contrib/swiftmailer/swift_required.php';
50 if (empty($this->mailSettings)) {
56 throw new \TYPO3\CMS\Core\Exception($e->getMessage(), 1291068569);
59 parent::__construct($this->transport);
80 switch ($this->mailSettings[
'transport']) {
83 list(
$host, $port) = preg_split(
'/:/', $this->mailSettings[
'transport_smtp_server']);
85 throw new \TYPO3\CMS\Core\Exception(
'$TYPO3_CONF_VARS[\'MAIL\'][\'transport_smtp_server\'] needs to be set when transport is set to "smtp"', 1291068606);
87 if ($port === NULL || $port ===
'') {
90 $useEncryption = $this->mailSettings[
'transport_smtp_encrypt'] ?: NULL;
92 $this->transport = \Swift_SmtpTransport::newInstance(
$host, $port, $useEncryption);
94 $username = $this->mailSettings[
'transport_smtp_username'];
95 if ($username !==
'') {
96 $this->transport->setUsername($username);
98 $password = $this->mailSettings[
'transport_smtp_password'];
99 if ($password !==
'') {
100 $this->transport->setPassword($password);
104 $sendmailCommand = $this->mailSettings[
'transport_sendmail_command'];
105 if (empty($sendmailCommand)) {
106 throw new \TYPO3\CMS\Core\Exception(
'$TYPO3_CONF_VARS[\'MAIL\'][\'transport_sendmail_command\'] needs to be set when transport is set to "sendmail"', 1291068620);
109 $this->transport = \Swift_SendmailTransport::newInstance($sendmailCommand);
112 $mboxFile = $this->mailSettings[
'transport_mbox_file'];
113 if ($mboxFile ==
'') {
114 throw new \TYPO3\CMS\Core\Exception(
'$TYPO3_CONF_VARS[\'MAIL\'][\'transport_mbox_file\'] needs to be set when transport is set to "mbox"', 1294586645);
121 $this->transport = \Swift_MailTransport::newInstance();
126 if ($customTransport instanceof \Swift_Transport) {
127 $this->transport = $customTransport;
129 throw new \RuntimeException($this->mailSettings[
'transport'] .
' is not an implementation of \\Swift_Transport, 130 but must implement that interface to be used as a mail transport.', 1323006478);
145 $this->mailSettings = (array)
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'];
static makeInstance($className)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
__construct(\Swift_Transport $transport=NULL)
injectMailSettings(array $mailSettings=NULL)