Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Subject of TemplatedEmail should also be in a template #54203

Copy link
Copy link
Closed
@gjuric

Description

@gjuric
Issue body actions

Description

The current solution allows for easy translation of email content since this is handled by Twig, but it still requires one to inject TranslatorInterface into the place where email is being generated to be able to translate the subject as well.

We have a home grown implementation of this where email template consist of 3 blocks:

  • subject
  • body_text (optional)
  • body_html

Email renderer then uses those block to set the subject, text and html portions of the email.

Seems like something that would be a nice improvement, although I see a possible issue since current implementation expects different templates for HTML and TEXT parts and having Subject in a separate file doesn't make sense IMHO.

Example

$email = (new TemplatedEmail())
    ->from('fabien@example.com')
    ->to(new Address('ryan@example.com'))
    ->template('emails/signup.twig')

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.