Mail

Categories

Component ID

10227

Component name

Mail

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

2769

Component created

Component changed

Component body

Provides a config entity for system emails, and a service for mailing any entity which implements the interface.

This project is intended as a testing ground for replacing hook_mail() in core: see https://www.drupal.org/node/1346036 for details.

Overview

This module's mail message entity type is intended for system emails, that is, emails where the text is initially defined in code, possibly configurable, and may be processed to have tokens replaced. Examples include user registration and password reset, content subscription emails, Commerce order emails, moderation notification emails, event reminder emails, and so on.

A mail message entity can define which mail backend to use, to override the site setting, and which mail processor plugin to use. The processor plugin does the equivalent work of hook_mail(): replaces tokens, and so on.

Modules using this system define their emails as default config entities. The 'group' property on mail message entities allows the creation of an admin list that only shows the mail message entities for a particular group, which modules defining messages can use to create an admin UI for editing their own emails. The Mail Example submodule provides an example of doing this.