Bug #96788
closed"Test Mail Setup" cannot send mails if HTML mail template uses <f:format.html>
100%
Description
In TYPO3 11.5.6, it's not possible to send a mail in the "Test Mail Setup" (backend module "Environment" or install tool) if the mail HTML template uses the Fluid ViewHelper f:format.html
. The following error occurs:
Could not deliver mail
Please verify $GLOBALS['TYPO3_CONF_VARS']['MAIL'][*] settings are valid. Error message: No valid attribute "applicationType" found in request object.
This worked well in TYPO3 10.4. Without the usage of the Fluid HTML ViewHelper or with the default mail template, the test mail is sent correctly in TYPO3 11.5, too.
Steps to reproduce the error:
- In the
LocalConfiguration.php
, add an additional template root path:
'MAIL' => [ // ... other configuration options ... 'templateRootPaths' => [ 20 => 'EXT:example/Resources/Private/Templates/Email/', ],
- Create a HTML template file
EXT:example/Resources/Private/Templates/Email/Default.html
:
<f:layout name="SystemEmail" /> <f:section name="Main"> {content -> f:format.html()} </f:section>
- Try to send a test mail in the install tool or the TYPO3 backend by using the "Test Mail Setup".
The error is thrown in the class \TYPO3\CMS\Core\Http\ApplicationType
in the method fromRequest(ServerRequestInterface $request)
.
It is called in \TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper
:
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$parseFuncTSPath = $arguments['parseFuncTSPath'];
$isBackendRequest = ApplicationType::fromRequest($renderingContext->getRequest())->isBackend();
The request of the Fluid rendering context doesn't have an application type attribute set.