Project

General

Profile

Feature #11276 ยป 15998-scheduler-test.diff

New Scheduler API - Example - Chris topher, 2011-01-08 23:18

View differences:

typo3/sysext/scheduler/examples/class.tx_scheduler_testtask.php (Arbeitskopie)
* 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
*
......
. '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);
    (1-1/1)