- Issue created by @AdamPS
- Issue was unassigned.
Part of stage 2 of π± [META] Adopt the symfony mailer component Needs review . 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 MailerInterface
send(EmailInterface $email)
- similar to base Mailer
classcreate(string $id, array $params);
that returns EmailInterface
isEnabled(string $id)
during the transition phase, allows modules to determine if they can use the new mail system. This check a global config setting, and allows hooks/events to alter the result per ID.Responsible for the email building pipeline
2) Callbacks: events and processors
Modules have two options for how to process mails.
EmailProcessorInterface
, which has a function for each phaseAll the events and functions have a single argument/member of type EmailInterface
.
3) 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:
subject(string $subject)
would force translation too soon, before the right language has been selected. We might prefer to rename setter method to match Drupal standard, e.g. setTo()
rather than to()
.Questions:
1) 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