- Issue created by @simgui8
- @simgui8 opened merge request.
- Status changed to Needs review
over 1 year ago 5:44pm 5 April 2023 - 🇬🇧United Kingdom adamps
Thanks for the suggestion.
Please can you explain how you would like to use this? I imagined that the email template would be used for markup specific to type, and the email wrap would be similar for all types. email-wrap.html.twig has variables for type and sub_type does that help?
- 🇨🇦Canada simgui8 Canada
Yes I needed other markups around the body for different types.
I had those 2 templates to migrates from swiftmailer:
swiftmailer--commerce--order-receipt.html.twig
swiftmailer--user--password-reset.html.twigI could use email-wrap.html.twig to override all types,
but couldn't use
email-wrap--commerce--receipt-resend.html.twig or
email-wrap--user--password-reset.html.twig - 🇬🇧United Kingdom adamps
Thanks for the reply.
Could you instead put
swiftmailer--user--password-reset.html.twig
intoemail--user--password-reset.html.twig
or use the GUI at/admin/config/system/mailer/policy/user.password_reset
? - 🇨🇦Canada simgui8 Canada
Well, as for the
user--password-reset.html.twig
, it's not important.
Just happened to have a few trivial mods I wanted to keep migrating to Symfony mailer.But I know I will for sure want to override
email-wrap.html.twig
per type in a lot of projects (like commerce projects).That leaves me with two options :
- adding a theme suggestion for
email-wrap.html.twig
in each project - adding this MR via a patch
The patch feels more straightforward and easier to maintain.
- adding a theme suggestion for
- 🇬🇧United Kingdom adamps
Sure I understand what you wish to do, thanks for explaining.
When I wrote the template code, I had expected that
email-wrap.html.twig
would be used for general markup that was the same for all emails. Thenemail.html.twig
(or mailer policy GUI) would be used for markup that was different for each type. Is there is a reason why you can't do it that way? - 🇨🇦Canada simgui8 Canada
I understand thanks.
Some of the things I may want per type:
- having styles in a head section
- doctypes
- inline styles on the body
Plus verifying each different email once. Changing
email-wrap.html.twig
may impact other templates.
When new "rich" email templates are added over time, they may have different wrappers. - 🇬🇧United Kingdom adamps
Thanks however I already understand that you want to change things per type.
As I already mentioned, there are three existing ways of changing things per type:
- Suggestions for email.html.twig
- Mailer Policy in the GUI
- Conditional code within
email-wrap.html.twig
usingtype
variable
Please can you explain why none of those work for you and you feel we need a 4th way?
- last update
over 1 year ago 5 pass - Status changed to Fixed
over 1 year ago 5:31pm 28 April 2023 - 🇬🇧United Kingdom adamps
OK thanks for the patch and explanation. Done with doc updates at https://www.drupal.org/docs/contributed-modules/drupal-symfony-mailer/ge... → .
Automatically closed - issue fixed for 2 weeks with no activity.