Project

General

Profile

Actions

Bug #92881

closed

FluidEmail not rendered for getHtmlBody()

Added by Mathias Brodala over 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
Start date:
2020-11-19
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #90266: Fluid-based templated emailsClosedBenni Mack2020-01-31

Actions
Actions #1

Updated by Mathias Brodala over 3 years ago

Actions #2

Updated by Oliver Bartsch over 2 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.

Actions #3

Updated by Mathias Brodala over 2 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:

https://github.com/pagemachine/typo3-mail-css-inliner/blob/154809b8613f9554dd65ed0cf1799bc8cbf935c8/Classes/Mail/Mailer.php#L23

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.

Actions #4

Updated by Oliver Bartsch over 2 years ago

Would it help if we would implement getHtmlBody() and getTextBody() to generate their corresponding content?

Actions #5

Updated by Mathias Brodala over 2 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. ;-)

Actions #6

Updated by Gerrit Code Review over 2 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

Actions #7

Updated by Oliver Bartsch over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #8

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF