Problem/Motivation
It would be useful to add an extra template that wraps all outgoing emails. This allows adding a header or footer, and adding classes based on the email type/sub-type to support theming.
Proposed resolution
Create a new EmailAdjuster for this purpose.
- Option: plain. Send as plain text only.
- Option: swiftmailer. Use the swiftmailer template and library scheme instead of the one from this module. This is intended as a short-term workaround and you should migrate to the new template when possible.
Create a new template email-wrap.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | symfony_mailer.wrap_.3271797-12.patch | 4.49 KB | adamps |
| #8 | symfony_mailer.wrap_.3271797-interdiff-7-8.txt | 2.36 KB | adamps |
| #8 | symfony_mailer.wrap_.3271797-8.patch | 13.84 KB | adamps |
| #7 | symfony_mailer.wrap_.3271797-interdiff-5-7.txt | 2.53 KB | adamps |
| #7 | symfony_mailer.wrap_.3271797-7.patch | 13.61 KB | adamps |
Comments
Comment #2
jwilson3+1 I'd rather have a way to explicitly render the same template (or a different template) for text only versions, in order to have more control to exclude html or other elements for a plaintext version.
Comment #3
adamps commentedComment #5
adamps commentedComment #6
adamps commentedComment #7
adamps commentedComment #8
adamps commentedComment #9
adamps commentedComment #10
adamps commentedComment #12
adamps commentedAfter more evaluation:
- the rewrap option makes no sense as it's likely actually slower to add all the HTML then remove it again and it's hard to understand
- it's inefficient to wrap the HTML then remove it straight after - add a new option 'plain' instead of the PlainOnlyEmailAdjuster.
Comment #14
adamps commentedComment #15
featuriz commentedAfter update to 1.1.0-beta2 my mail stopped entire styling. It breaks.
I was already doing something like following,
My file name is: email--contact-form--mail--contact-us.html.twig // This name was working before this update.
email_template.html.twig:- Contains all header footer extras.
_body.html.twig: - Contains the following code,
Help me please:- It was working before. No styles in GMail.
Comment #16
featuriz commentedGoing back with : composer require 'drupal/symfony_mailer:^1.0@beta' is not working for me.
Comment #17
andyd328Same issue here but reverting to "drupal/symfony_mailer": "1.1.0-beta1" has inline theming working for me.
My site uses the default commerce email receipt template.
Comment #18
jons commentedI found this too.
This is because there are 2 default templates now: email.html.twig and a new one email-wrap.html.twig .
email.html.twig just has {{body}} in it, all styling is in email-wrap.html.twig
I copied email-wrap.html.twig from the module to my theme template directory and transferred the styling over from my email.html.twig then copied the revised email.html.twig .
If you are using THEME_preprocess_email() that needs renaming to THEME_preprocess_email_wrap()
Clear caches
Comment #20
fenstratThis email wrapping caused inline styles to be stripped, issue for that is #3313675: Style tags in email body get stripped.