Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inlining of CSS does not work with FluidEmail #23

Closed
dahaupt opened this issue Nov 19, 2020 · 3 comments · Fixed by #48
Closed

Inlining of CSS does not work with FluidEmail #23

dahaupt opened this issue Nov 19, 2020 · 3 comments · Fixed by #48

Comments

@dahaupt
Copy link

dahaupt commented Nov 19, 2020

Using the newly introduced \TYPO3\CMS\Core\Mail\FluidEmail, CSS is not inlined as expected.

As already discussed with @mbrodala this is related to this bug in the core:
https://forge.typo3.org/issues/92881

@dahaupt
Copy link
Author

dahaupt commented Mar 4, 2021

I think the CSS would not be inlined, even if the Core issue would be solved, because the HTML is rebuild in a later stage of the sending process.

The constructor of the class vendor/symfony/mailer/SentMessage.php:33 executes $message->ensureValidity(); which renders the view.

So we currently only really have the option to overwrite rendering methods of class FluidEmail, e.g. method renderContent().

@mbrodala Feel free to ping me on slack to discuss a possible workaround for a hopefully upcoming next release.

@mbrodala
Copy link
Member

Work on a possible workaround/fix in TYPO3 has started:

71714: [BUGFIX] Fix rendering of specific format body in FluidEmail | https://review.typo3.org/c/Packages/TYPO3.CMS/+/71714

@mbrodala
Copy link
Member

@dahaupt I now went a completely different way since the mentioned change does not help at all.

As you have discovered, the HTML part of FluidEmail is rendered and set numerous (precisely: 3) times during the course of sending an email.

For this reason I now went for replacing FluidEmail::html() and inlining the styles there. This won't prevent the seemingly pointless repeated rendering but will at least yield the same result afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants