[TYPO3-dev] Scheduled mail send problem

Valeria Tabolsky valeria.tabolsky at ext.jrc.ec.europa.eu
Thu Feb 5 14:54:00 CET 2015


Hi dear colleagues, 

1)  I try to implement a scheduled job that will send the emails taking information from DB table. So I created a Task extending \TYPO3\CMS\Scheduler\Task\AbstractTask .  it injects the repository, retrieves all unsent emails correctly. I checked the TO email and it's correct, Mailer configuration (host, password etc) and everything is fine. Then I create the  MailMessage instance, provide it with all necessary information and send. 
$res = $mail->send();

And nothing happens: $res = 0 and  $mail->getFailedRecipients ()  contains the recipient. No errors, no logs. 

If I invoke the same functionality from frontend (as a simple controller action) the mail is sent successfully. So we can refuse the suspects about mail server, connectivity etc.

2) I tryed another way, creating  CommandController as follows:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'] = \Vendor\Emailcenter\Command\SendMailCommandController::class;

but here it's even worse: I can't add scheduled job from backend.  Once selected   'Extbase CommandController Task'   I suppose I must be able to select my command class in dropdown  below, but it's empty. So i can't even add the task. 

BTW what is the difference between Task and CommandController and which one is preferable for my purpose? 

3)  Let's suppose I have resolved the above problem in one way or another and the mail are send out. Then I need to configure Windows scheduled job to trigger my task. I used the following command:

schtasks /create /sc minute /mo 5 /tn "T3scheduler" /tr "C:\php-5.6\php.exe C:\Program Files (x86)\Apache Software Foundation\Apache2.4\htdocs\typo3\cli_dispatch.phpsh scheduler --debugOutput=true"

as it's advised in Typo3 official documentation. But even here I have a problem :) I see the command prompt window pops up every 5 min and disappears. But nothing happens on the Typo3 side. Last Execution of scheduled task remains in the past when I ran it manually, Next Execution is red and in the past too. Seems that windows scheduler doesn't trigger the Typo3 scheduler. 

If I run the command 

C:\php-5.6\php.exe "C:\Program Files (x86)\Apache Software Foundation\Apache2.4\htdocs\typo3\cli_dispatch.phpsh" scheduler

manually from command prompt, the result is exactly as running the Task manually from Typo3 backend.

Please somebody help me :)




 



More information about the TYPO3-dev mailing list