|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Ernesto Baschny <ernst@cron-it.de> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 00028 require_once(PATH_typo3 . 'contrib/swiftmailer/swift_required.php'); 00029 00030 00031 /** 00032 * Adapter for Swift_Mailer to be used by TYPO3 extensions 00033 * 00034 * $Id$ 00035 * 00036 * @author Ernesto Baschny <ernst@cron-it.de> 00037 * @package TYPO3 00038 * @subpackage t3lib 00039 */ 00040 class t3lib_mail_Message extends Swift_Message { 00041 00042 /** 00043 * @var t3lib_mail_Mailer 00044 */ 00045 protected $mailer; 00046 00047 /** 00048 * @var string This will be added as X-Mailer to all outgoing mails 00049 */ 00050 protected $mailerHeader = 'TYPO3'; 00051 00052 /** 00053 * True if the message has been sent. 00054 * @var boolean 00055 */ 00056 protected $sent = FALSE; 00057 00058 /** 00059 * Holds the failed recipients after the message has been sent 00060 * @var array 00061 */ 00062 protected $failedRecipients = array(); 00063 00064 /** 00065 * 00066 * @return void 00067 */ 00068 private function initializeMailer() { 00069 $this->mailer = t3lib_div::makeInstance('t3lib_mail_Mailer'); 00070 } 00071 00072 /** 00073 * Sends the message. 00074 * 00075 * @return integer the number of recipients who were accepted for delivery 00076 * @author Karsten Dambekalns <karsten@typo3.org> 00077 */ 00078 public function send() { 00079 $this->initializeMailer(); 00080 $this->sent = TRUE; 00081 $this->getHeaders()->addTextHeader('X-Mailer', $this->mailerHeader); 00082 return $this->mailer->send($this, $this->failedRecipients); 00083 } 00084 00085 /** 00086 * Checks whether the message has been sent. 00087 * 00088 * @return boolean 00089 * @author Karsten Dambekalns <karsten@typo3.org> 00090 */ 00091 public function isSent() { 00092 return $this->sent; 00093 } 00094 00095 /** 00096 * Returns the recipients for which the mail was not accepted for delivery. 00097 * 00098 * @return array the recipients who were not accepted for delivery 00099 * @author Karsten Dambekalns <karsten@typo3.org> 00100 */ 00101 public function getFailedRecipients() { 00102 return $this->failedRecipients; 00103 } 00104 00105 } 00106 00107 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_message.php'])) { 00108 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_message.php']); 00109 } 00110 00111 ?>
1.8.0