{# /** * @file * Default template for HTML Mail. * * DO NOT EDIT THIS FILE. Copy it to your theme directory, and edit the copy. * * ========================================================= Begin instructions. * * When formatting an email message with a given $module and $key, [1]HTML * Mail will use the first template file it finds from the following list: * 1. htmlmail--$module--$key.html.twig * 2. htmlmail--$module.html.twig * 3. htmlmail.html.twig * * For each filename, [2]HTML Mail looks first in the chosen Email theme * directory, then in its own module directory, before proceeding to the * next filename. * * For example, if example_module sends mail with: * drupal_mail("example_module", "outgoing_message" ...) * * * the possible template file names would be: * 1. htmlmail--example_module--outgoing_message.html.twig * 2. htmlmail--example_module.html.twig * 3. htmlmail.html.twig * * Template files are cached, so remember to clear the cache by visiting * admin/config/development/performance after changing any .html.twig files. * * The following variables available in this template: * * message.body * The message body text. * * message.module * The first argument to [3]drupal_mail(), which is, by convention, * the machine-readable name of the sending module. * * message.key * The second argument to [4]drupal_mail(), which should give some * indication of why this email is being sent. * * message.message_id * The email message id, which should be equal to * "{$module}_{$key}". * * message.headers * An array of email (name => value) pairs. * * message.from * The configured sender address. * * message.to * The recipient email address. * * message.subject * The message subject line. * * message.body * The formatted message body. * * message.language * The language code for this message. * * message.params * Any module-specific parameters. * * template_name * The basename of the active template. * * template_path * The relative path to the template directory. * * template_url * The absolute URL to the template directory. * * theme * The name of the Email theme used to hold template files. If the * [5]Echo module is enabled this theme will also be used to * transform the message body into a fully-themed webpage. * * theme_path * The relative path to the selected Email theme directory. * * theme_url * The absolute URL to the selected Email theme directory. * * debug * TRUE to add some useful debugging info to the bottom of the * message. * * Other modules may also add or modify theme variables by implementing a * MODULENAME_preprocess_htmlmail(&$variables) [6]hook function. * * References * * 1. http://drupal.org/project/htmlmail * 2. https://www.drupal.org/documentation/theme * 3. https://www.drupal.org/developing/api/8/render * 4. http://drupal.org/project/echo * * =========================================================== End instructions. */ #}
To customize this message:
Visit admin/config/system/htmlmail and select a theme to hold your custom email template files.
Visit admin/appearance to enable your selected {{ theme|capitalize }} theme.
Edit your
{{ _self.getTemplateName() }}
file.
Copy
{{ module_path }}/htmlmail.html.twig
to
{{ theme_path }}/htmlmail.html.twig
For module-specific customization, copy
{{ module_path }}/htmlmail.html.twig
to
{{ theme_path }}/{{ module_template }}
For message-specific customization, copy
{{ module_path }}/htmlmail.html.twig
to
{{ theme_path }}/{{ message_template }}
Edit the copied file.
Send a test message to make sure your customizations worked.
If you think your customizations would be of use to others, please contribute your file as a feature request in the issue queue.
The {{ message.module }} module sets the message.params
variable. For this message,
$params = {{ pre_formatted_params }}