Issue Bug Closed

#93088TYPO3 10 $mail->send() won't send mails via cron (Symfony MailMessage)

Aristeidis Karavas 12/16/20, 12:25 updated 01/06/22, 14:20

Description

I have the exact same code on a TYPO3 9 and TYPO3 10 installations.

$mail = GeneralUtility::makeInstance(MailMessage::class);
$mail->from(new Address($sender['email'], $sender['name']));
$mail->to(new Address($recipient['email'], $recipient['name']));
$mail->subject($subject);
$emailView->assignMultiple(
      [
          'logs' => $log,
          'recipient' => $recipient
      ]
 );
$emailBody = $emailView->render();
$mail->html($emailBody, 'text/html');
$mail->send();

If i run the Task on the Backend, it works on both version.

If i run it via cron or sh ./typo3CronTrigger then the – >send() command does not send the mail. I debugged everything up until the $mail ->html($emailBody, ‘text/html’); and i see my debug on my terminal. If i debug the $mail variable after the ->send() command, it doesn’t show anything because it breaks.

This happens only in TYPO3 10. In TYPO3 9 works just fine.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.