Skip to content

Make it possible to have separate email templates for html and plain-text #178

@RafaelKr

Description

@RafaelKr
Q A
Bug? no
New Feature? yes
Community Bundle Version ^2.0@dev, 17e2867
Sulu Version 2.6.5
Browser Version -

Actual Behavior

Currently we can only define one email template per type (registration, email confirmation, ...).

If you use an HTML template Symfony will automatically generate a text version based on the following rules:
https://symfony.com/doc/current/mailer.html#text-content

When you have an advanced template with a footer with a lot of information this has the downside, that probably the indentation is completely off. Also sometimes we just want to have a different templates for html and text.

Expected Behavior

It would be good to be able to define two separate templates.

Steps to Reproduce

Possible Solutions

Maybe we could have user_template and admin_template and additionally user_template_plain and admin_template_plain.

Or, my preferred option, we define it like user_template: community/email-confirmation-email and it will automatically try to find community/email-confirmation-email.html.twig and community/email-confirmation-email.txt.twig.
Also see: https://symfony.com/doc/current/mailer.html#text-content

I'm open to create a PR for my preferred approach.

Btw instead of new Email we could also use new TemplatedEmail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions