mail_action
This module adds configurable actions for sending mails. Drupal core only provides a mail action that supports plain text. This module adds further mail actions that allow to send formatted text and raw HTML.
Features
Adds the ability to send mails with HTML formatting anywhere actions are supported, for example in Views Bulk Operations and ECA.
Post-Installation
Once installed, you have two more action plugins available. They can be used anywhere actions are involved.
The new action plugins are called
- "Send email with formatted text" - there you can choose your preferred configured WYSIWYG editor and format your mail using that way.
- "Send email with raw HTML" - provides a textarea where you can insert raw HTML. It additionally supports Tokens and Twig template language.
Additional Requirements
This module only requires Drupal core. No other contrib module is required.
Recommended modules/libraries
This module is especially useful in combination with another module that makes use of actions. For example
Similar projects
This module is very simplistic by just adding new action plugins. If you need more extensive mail functionality, have a look at following solutions:
- Easy Email - this module also adds action plugins. If you use that module, this module here is most probably not needed anymore on your site.
- Symfony Mailer
- Mail System
Installation
Install the module as you would normally install a contributed
Drupal module. Visit https://www.drupal.org/node/1897420 for further
information.
You probably need to initially configure the mailer DSN settings of your
site. More details about configuring the transport DSN can be found here:
https://www.drupal.org/node/3369935
Following example can be used in a local `settings.php` file to test mailing
locally with MailHog (https://github.com/mailhog/MailHog):
<?php
// Mailer DSN settings for local testing with MailHog.
$config['system.mail']['mailer_dsn'] = [
'scheme' => 'smtp',
'host' => 'localhost',
'port' => 1025,
];
// Following part is usually not needed. This will be automatically configured
// when installing the module.
$config['system.mail']['interface']['mail_action'] = 'mail_action_html';
?>