2 /***************************************************************
5 * (c) 2010 Ernesto Baschny <ernst@cron-it.de>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 require_once(PATH_typo3
. 'contrib/swiftmailer/swift_required.php');
32 * Adapter for Swift_Mailer to be used by TYPO3 extensions
36 * @author Ernesto Baschny <ernst@cron-it.de>
40 class t3lib_mail_message
extends Swift_Message
{
43 * @var t3lib_mail_mailer
48 * True if the message has been sent.
54 * Holds the failed recipients after the message has been sent
57 var $failedRecipients = array();
63 private function initializeMailer() {
64 $this->mailer
= t3lib_div
::makeInstance('t3lib_mail_mailer');
70 * @return integer the number of recipients who were accepted for delivery
71 * @author Karsten Dambekalns <karsten@typo3.org>
73 public function send() {
74 $this->initializeMailer();
76 return $this->mailer
->send($this, $this->failedRecipients
);
80 * Checks whether the message has been sent.
83 * @author Karsten Dambekalns <karsten@typo3.org>
85 public function isSent() {
90 * Returns the recipients for which the mail was not accepted for delivery.
92 * @return array the recipients who were not accepted for delivery
93 * @author Karsten Dambekalns <karsten@typo3.org>
95 public function getFailedRecipients() {
96 return $this->failedRecipients
;
101 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['t3lib/class.t3lib_mail_message.php']) {
102 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['t3lib/class.t3lib_mail_message.php']);