No mails sent if {f:cObject ...} in mail body
When using {f:cObject ...} in the mail body of sender or receiver no mails will be sent. Didn't tested other viewhelpers yet. But I think this was the only one supported viewhelper?
The Logfile says:
[CRITICAL] request="e7225d0b096bb" component="In2code.Powermail.Controller.FormController": Mail could not be sent - ["TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::getContentObjectRenderer(): Argument #1 ($request) must be of type Psr\Http\Message\ServerRequestInterface, null given, called in /usr/www/users/yfsrww/develop/xxx/vendor/typo3/cms-fluid/Classes/ViewHelpers/CObjectViewHelper.php on line 130"]
The crash occurs here:
In2code\Powermail\Domain\Service\Mail\SendMailService->prepareAndSend(array $email)
$message = $this->addHtmlBody($message, $email)
Will further debug.
Harald
Ok, problem solved.
Using {f:cObject ...} in mail to sender and/or receiver triggers the usage of In2code\Powermail\ViewHelpers\Misc\VariablesViewHelper.
This ViewHelper creates a StandaloneView without setting the request properly. But this is needed in Typo3 12.
So it should look like this:
$parseObject = GeneralUtility::makeInstance(StandaloneView::class);
$parseObject->setRequest($this->renderingContext->getRequest());
I'll create another pull request.
Related issue: #990
Ok, here is a new pull request based on the current master: https://github.com/in2code-de/powermail/pull/1151
Fixed with d9b91b3e671f4826dfa8d2d5e2c170f385987b2b
Thanks for the PR :-)
I can confirm that #1151 fixes this issue here! Thanks, @haraldwitt!