2 namespace TYPO3\CMS\Scheduler\Example;
38 if (!empty($this->email)) {
42 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(
'[TYPO3\\CMS\\Scheduler\\Example\\TestTask]: Test email sent to "' . $this->email .
'"',
'scheduler', 0);
46 if (basename(PATH_thisScript) ==
'cli_dispatch.phpsh') {
47 $calledBy =
'CLI module dispatcher';
50 $calledBy =
'TYPO3 backend';
51 $site = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv(
'TYPO3_SITE_URL');
53 $start = $exec->getStart();
54 $end = $exec->getEnd();
55 $interval = $exec->getInterval();
56 $multiple = $exec->getMultiple();
57 $cronCmd = $exec->getCronCmd();
58 $mailBody =
'SCHEDULER TEST-TASK' . LF .
'- - - - - - - - - - - - - - - -' . LF .
'UID: ' . $this->taskUid . LF .
'Sitename: ' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] . LF .
'Site: ' . $site . LF .
'Called by: ' . $calledBy . LF .
'tstamp: ' . date(
'Y-m-d H:i:s') .
' [' . time() .
']' . LF .
'maxLifetime: ' . $this->scheduler->extConf[
'maxLifetime'] . LF .
'start: ' . date(
'Y-m-d H:i:s', $start) .
' [' . $start .
']' . LF .
'end: ' . (empty($end) ?
'-' : date(
'Y-m-d H:i:s', $end) .
' [' . $end .
']') . LF .
'interval: ' . $interval . LF .
'multiple: ' . ($multiple ?
'yes' :
'no') . LF .
'cronCmd: ' . ($cronCmd ? $cronCmd :
'not used');
62 $mailer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class);
63 $mailer->setFrom(array($this->email =>
'SCHEDULER TEST-TASK'));
64 $mailer->setReplyTo(array($this->email =>
'SCHEDULER TEST-TASK'));
65 $mailer->setSubject(
'SCHEDULER TEST-TASK');
66 $mailer->setBody($mailBody);
67 $mailer->setTo($this->email);
68 $mailsSend = $mailer->send();
69 $success = $mailsSend > 0;
70 }
catch (\Exception $e) {
71 throw new \TYPO3\CMS\Core\Exception($e->getMessage());
75 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(
'[TYPO3\\CMS\\Scheduler\\Example\\TestTask]: No email address given',
'scheduler', 2);
87 return $GLOBALS[
'LANG']->sL(
'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.email') .
': ' .
$this->email;