Skip to content

TemplatedEmail are rendered two times #39718

@pupaxxo

Description

@pupaxxo

Symfony version(s) affected: 4.4.18

Description

TemplatedEmail are rendered two times: both the Mailer and the AbstractTransport class dispatch a MessageEvent.
The renderer (generally the BodyRenderer from TwigBridge) do not check if the email is already rendered and override the email contents (re-rendering the twig template).

How to reproduce
Send an email and check the event dispatcher logs, you can use a twig extension with a filter called inside the twig template to easily catch it.
image

Possible Solution
The render should check if the templated email is already rendered? Or maybe dispatch the email only one time?

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions