powermail icon indicating copy to clipboard operation
powermail copied to clipboard

No mails sent if {f:cObject ...} in mail body

Open haraldwitt opened this issue 1 year ago • 1 comments

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

haraldwitt avatar Jun 14 '24 13:06 haraldwitt

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.

haraldwitt avatar Jun 17 '24 10:06 haraldwitt

Related issue: #990

mschwemer avatar Aug 15 '24 10:08 mschwemer

Ok, here is a new pull request based on the current master: https://github.com/in2code-de/powermail/pull/1151

haraldwitt avatar Sep 30 '24 13:09 haraldwitt

Fixed with d9b91b3e671f4826dfa8d2d5e2c170f385987b2b

mschwemer avatar Oct 09 '24 15:10 mschwemer

Thanks for the PR :-)

mschwemer avatar Oct 09 '24 15:10 mschwemer

I can confirm that #1151 fixes this issue here! Thanks, @haraldwitt!

kitzberger avatar Oct 11 '24 09:10 kitzberger