- Issue created by @adamps
- Issue was unassigned.
- 🇬🇧United Kingdom adamps
I split out the original issue creating 2 new ones
✨ Events/callbacks for new mailer service Active
✨ Create a new mailer service to wrap symfony mailer Active
Part of stage 2 of 🌱 [META] Adopt the symfony mailer component Active . Create a new API with direct access to all the power of Symfony Mailer. Enhances the symfony code with integration into Drupal mechanisms, including theme/template/render, multi-language, CSS libraries, configuration, plug-ins, hooks, and logging.
1) New service 'mailer'
Thin wrapper on top of Symfony\Component\Mailer\Mailer
Mailer implements MailerInterfacesend(EmailInterface $email) - similar to base Mailer classcreate(string $type, string $sub_type, array $params); that returns EmailInterfacemail(string $type, string $sub_type, array $params); that creates and sends, delegating all building to an "Email Builder" - similar to MailManagerInterfaceMain responsibilities:
2) New class Email implements EmailInterface
This would enhance the symfony base class with some new fields:
We need to make some changes to the base class. For example the base function subject(string $subject) would force translation too soon, before the right language has been selected.
3) Callbacks: events and processors
The email building pipeline has the following phases: build, render, post-render, send, post-send. The ones in italics are done by the Mailer, the others are done by code that builds/alters emails. For the latter case, there are two options:
EmailProcessorInterface, which has a function for each phaseAll the events and functions have a single argument/member of type EmailInterface.
4) Email Builder
Implemented by a module to send emails (resembling the old hook_mail() callback). This is optional and modules can also build mails directly.
@EmailBuilder with classes implementing EmailProcessorInterfaceEmailBuilderManager implementing EmailBuilderManagerInterfaceQuestions:
1) Should we create a new module mailer, initially experimental?
2) Should the new class Email extend the base symfony one, or decorate it (meaning have a class variable $inner containing the base class)?
None
See proposed resolution
None
I split out the original issue creating 2 new ones
✨
Events/callbacks for new mailer service
Active
✨
Create a new mailer service to wrap symfony mailer
Active