0
votes

I’m using the new TYPO3\CMS\Core\Mail\FluidEmail feature of TYPO3 v10.3 to send HTML system e-mails. Unfortunately, I’m experiencing a weird behavior with Viewhelpers in the e-mail Templates. Calling the regular Viewhelper notation like e.g. <f:uri.resource extensionName="backend" path="Images/typo3_orange.svg"/> works as expected. But inline notations of the same Viewhelper (like {f:uri.resource(extensionName: 'backend', path: 'Images/typo3_orange.svg')}) don’t get processed at all.

Surprisingly, when I call the regular notation first and the inline notation afterwards in the same template, both notations get resolved.

I also experienced that no fluid variables are accessible in the template, e.g. {normalizedParams}, which should be available when you set the request like $message->setRequest($GLOBALS['TYPO3_REQUEST']);

Did anyone experience a similar behavior and has a hint for me?

Here's my implementation in my Controller Action:

$message = GeneralUtility::makeInstance(FluidEmail::class);
$message
    ->to($email)
    ->format(FluidEmail::FORMAT_HTML)
    ->setTemplate('MyTemplate')
    ->assign('pages', $pages);
if ($GLOBALS['TYPO3_REQUEST'] instanceof ServerRequestInterface) {
    $message->setRequest($GLOBALS['TYPO3_REQUEST']);
}
GeneralUtility::makeInstance(Mailer::class)->send($message);

Reference: https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.3/Feature-90266-Fluid-basedTemplatedEmails.html

1

1 Answers

0
votes

Sounds like a fluid parsing problem. Do you have any { or } flying around in your template that could mess up fluids parsing?