Fixed bug #17108: Make scheduler sample task use SwiftMailer (Thanks to Ernesto Baschny)
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 18 Jan 2011 22:45:15 +0000 (22:45 +0000)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 18 Jan 2011 22:45:15 +0000 (22:45 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10130 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/scheduler/examples/class.tx_scheduler_testtask.php

index 1bec010..fdf9e7a 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
 
 2011-01-18  Christian Kuhn  <lolli@schwarzbu.ch>
 
+       * Fixed bug #17108: Make scheduler sample task use SwiftMailer (Thanks to Ernesto Baschny)
        * Fixed bug #17130: [Caching framework] Remove commented code from db backend
        * Fixed bug #12232: [Performance] md5_file() to check if a file has been changed is very expensive (Thanks to André Stösel and Vladimir Podkovanov)
        * Fixed bug #16685: [Performance] Not using table index while deleting cached imagesize (Thanks to Vladimir Podkovanov)
index ef94ecf..cd0862d 100644 (file)
@@ -22,8 +22,6 @@
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 
-require_once(PATH_t3lib . 'class.t3lib_htmlmail.php');
-
 /**
  * Class "tx_scheduler_TestTask" provides testing procedures
  *
@@ -91,18 +89,19 @@ class tx_scheduler_TestTask extends tx_scheduler_Task {
                                . 'cronCmd: ' . ($cronCmd ? $cronCmd : 'not used');
 
                                // Prepare mailer and send the mail
-                       $mailer = t3lib_div::makeInstance('t3lib_htmlmail');
-                       $mailer->start();
-                       $mailer->from_email = $this->email;
-                       $mailer->from_name = 'SCHEDULER TEST-TASK';
-                       $mailer->replyto_email = $this->email;
-                       $mailer->replyto_name = 'SCHEDULER TEST-TASK';
-                       $mailer->subject = 'SCHEDULER TEST-TASK';
-                       $mailer->setPlain($mailer->encodeMsg($mailBody));
-                       $mailer->setRecipient($this->email);
-                       $mailer->setHeaders();
-                       $mailer->setContent();
-                       $success = $mailer->sendtheMail();
+                       try {
+                               /** @var $mailer t3lib_mail_message */
+                               $mailer = t3lib_div::makeInstance('t3lib_mail_message');
+                               $mailer->setFrom(array($this->email => 'SCHEDULER TEST-TASK'));
+                               $mailer->setReplyTo(array($this->email => 'SCHEDULER TEST-TASK'));
+                               $mailer->setSubject('SCHEDULER TEST-TASK');
+                               $mailer->setBody($mailBody);
+                               $mailer->setTo($this->email);
+                               $mailsSend = $mailer->send();
+                               $success = ($mailsSend>0);
+                       } catch (Exception $e) {
+                               throw new t3lib_exception($e->getMessage());
+                       }
                } else {
                                // No email defined, just log the task
                        t3lib_div::devLog('[tx_scheduler_TestTask]: No email address given', 'scheduler', 2);