Skip to content

Email Templates

Global email templates list

Email templates list

The email templates page allows you to view all the email templates in your project:

  • ID + label
  • Type (HTML, text, etc.)
  • Area (frontend, adminhtml, etc.)
  • File
  • Module

Module email templates list

In the module detail view, you can see the email templates declared by this module.

Module email template creation

You can create a new command by clicking Generate > Email template button from the module detail view.

Email template create

The following files are created/updated in app/code/Vendor/Module when you create a new email template:

  • etc/email_templates.xml: created if it does not exist, or updated with the new email template declaration
  • view/<area>/email/<email-template-id>.<type>: created with the new email template

Example of a generated email template

etc/email_templates.xml

xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
  <template id="mb_test_custom_email" label="Hello" file="mb_test_custom_email.html" type="html" area="adminhtml" module="MB_Test"/>
</config>

view/adminhtml/email/mb_test_custom_email.html

html
<!--@subject {{trans "Hello"}} @-->
<!--@vars {
} @-->
{{template config_path="design/email/header_template"}}

<p>Place your email content here</p>

{{template config_path="design/email/footer_template"}}

Released under the MIT License.
This project is not affiliated with, endorsed by, or sponsored by Adobe Inc. "Magento" and "Adobe Commerce" are trademarks of Adobe Inc.
All trademarks and registered trademarks are the property of their respective owners.