Bug #92881
closedFluidEmail not rendered for getHtmlBody()
100%
Description
Currently the FluidEmail
added with #90266 triggers rendering of its text and HTML body only on getBody()
call. When calling getHtmlBody()
instead, no rendering is triggered. Calling getHtmlBody()
after calling getBody()
will return the rendered HTML body of course.
This needs to be fixed so that each body getter renders its own part.
Updated by Mathias Brodala about 4 years ago
- Related to Feature #90266: Fluid-based templated emails added
Updated by Oliver Bartsch about 3 years ago
- Status changed from New to Needs Feedback
Hi, IMO this is the correct behaviour. getBody()
is actually implemented in FluidEmail
to generate the the body (text / html or both) by rendering the fluid template and assigning the result to the parent class variables ($html / $text) depending on the selected $format
. The getHtmlBody
and its counterpart getTextBody
are just getters of the underlying Symfony\Component\Mime\Email
component, which do not relate to any fluid rendering, but instead just return the current value of the corresponding class variables. Therefore those can only return the rendered part, when the getBody
implementation had been called beforehand.
What exactly is your use case here? Do you need the ability to define just one format to be rendered? This would be possible using the ->format()
method.
Updated by Mathias Brodala about 3 years ago
Oliver Bartsch wrote in #note-2:
What exactly is your use case here? Do you need the ability to define just one format to be rendered? This would be possible using the
->format()
method.
My usecase is our package https://packagist.org/packages/pagemachine/typo3-mail-css-inliner
Currently FluidEmail
is not supported here: https://github.com/pagemachine/typo3-mail-css-inliner/issues/23
Right now we call getHtmlBody()
to check if a mail needs to be processed at all:
As you can imagine, this is currently not working at all for FluidEmail
since getHtmlBody()
will return nothing until getBody()
is called explicitly or implicitly (default).
That's why I'm trying to figure out a good way for supporting FluidEmail
here.
Updated by Oliver Bartsch about 3 years ago
Would it help if we would implement getHtmlBody() and getTextBody() to generate their corresponding content?
Updated by Mathias Brodala about 3 years ago
Oliver Bartsch wrote in #note-4:
Would it help if we would implement getHtmlBody() and getTextBody() to generate their corresponding content?
Sure, that's what this ticket is about. ;-)
Updated by Gerrit Code Review about 3 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/71714
Updated by Oliver Bartsch about 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 695c6ad1e2a6e6b0396c80010bdaf0af4b0767fd.