Activity on #3539651: Introduce email plugins was a bit lower in February. Work on automated tests is going on. This uncovered some pieces missing in the API. E.g., it is impossible to modify email params from hook_email_pre_build_alter. Also the template only has params available and nothing else (e.g., no langcode, no information identifying the email like id, module, key, etc.).

The first problem can be solved by adding getters and setters to the EmailInterface and the EmailPluginDefault class.

Discussion about the second issue started with a suggestion to add the plugin instance as a template variable (everybody seemed to agree to that). Then the group started to explore UX and DX of the yaml+template based email case.

At the current state of the MR it is necessary to add an email declaration to a yaml file, add a template to the template folder and additionally declare the template using a theme hook. The current MR does some magic theme-registry trickery to make it unnecessary to declare the theme function in the email yaml file. But the rest of the yaml declaration and the hook theme implementation obviously is still needed.

It was proposed to instead let the mailer module implement a theme hook which dynamically creates theme declarations from the email plugin definitions. Much like layout theme declarations which are generated dynamically from layout plugin definitions. If the email plugin declares that it likes to render the html and/or text body using a twig template, then the theme declarations are generated automatically.

This proposal raised DX concerns. For Drupal developers it’s clear that every template needs to be accompanied by a hook theme declaration. So what if a developer supplies its own declaration? Will it be overridden by the generated one?

On the other hand there are other examples in core with custom theme/template discovery. One is the mentioned layout manager, the other one is SDC which supplies its own twig loader.

Other than #3539651: Introduce email plugins some work went into #3539178: Extract _user_mail_notify() into a user NotificationHandler. There will be a core conversation session at devdays in Athens. The cfp is open for Drupalcamp Kortrijk.

What’s next:

  • Async communication in Drupal #symfony-mailer slack channel.
  • Next planning meeting takes place April 1st 2026 at 4PM UTC+2.

Comments

znerol created an issue. See original summary.

znerol’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.