Magento 2 email templates

Instead of customizing default Magento 2 email template you are recommended to create your own templates and set Magento 2 to use them instead of the default ones. In this case, you can add unique email templates in Magento 2 as physical files in your theme or create them using the Admin Panel. We are going to describe how to create the Magento email templates via the Admin Panel without any programmtical skills. 

Make sure your emails reach customers with the help of Magento 2 SMTP extension.

How to customize Magento 2 email templates via the Admin Panel?

Keep in mind that any Magento 2 custom templates created via the Admin Panel have priority over default or theme-based templates. To edit Magento 2 email templates do the following:

  • Log in to the Admin Panel;
  • Navigate to Marketing>Communications>Email Templates:

marketing-email-template

  • Choose ‘Add New Template’ and make the next settings:

new-template-magento

Load default template

Template:

load-default-template-magento

Choose one of the templates to use it as a jumping-off point. For example, you can load Magento transactional email template and customize it with variables.

Template Information

Template Name: enter the name you want to identify the template in the Admin Panel;
Template Information: edit the subject of the Magento 2 email template, which is to be displayed in the subject line once it’s sent. The field can include system variable if you choose them:

system-variables-magento

Template Content: type in the content of the future template;
Template Style: add CSS styles for the template in the field. The style elements will be included in the <head> tag of the file put between tag <style>...</style>. Though some email clients don’t support styles in the tags, therefore you’ll have to use LESS files instead. The styles will be included in the template_styles variable.

  • Click the ‘Save Template’ button.

How to enable a custom email template in Magento 2?

After a new email template is added\created you need to set it to be applied in Magento 2.

  • Navigate to Stores>Settings>Configuration>Sales>Sales Emails:

sales-emails-magento

  • If you want to override the template for Magento 2 order confirmation emails, open the Order drop-down menu and choose the New Order Confirmation Template option:

new-order-template-magento

  • Choose the custom email template from the drop-down list;
  • Click the ‘Save Config’ button and flush the cache.

If you need to add them using a theme, follow the link.

Now, you can send emails with a custom Magento template.

Email hacks for Magento 2

Email templates location in Magento 2

The templates are stored in <module_dir>/view/<area>/email directory of the respective modules.

Magento 2 email templates variables

If you want to customize an email template, use the system variables described above. You can also use your own variables and set the values in the Admin Panel. For this, go to System>Custom Variables:

system-custom-variables-magento

email templates logo

via the Theme

You can customize an email logo using a theme:

  • add a file named logo_email.png to Magento_Email/web:

E.g.: If Amasty wants to enter logo, it should be added to app/design/frontend/Amasty/amasty/Magento_Email/web directory;

  • edit width and height attributes of <img> tag:

E.g.:



  • Include the if/else conditional statement just in case you want to change the values via the Admin Panel.

via the Admin Panel

  • Go to Stores>Settings>Configuration>General>Design>Email to add image to the Magento 2 email template. In the Emails drop-down menu upload the image and set the width/height:

email-logo-magento

email templates css

The email styles are divided between several files. To find a necessary one and edit or customize the theme settings, follow the link.

module email template

How to create Magento 2 transactional emails? You can implement the Follow Up Email extension to easily customize follow-up email templates, create Magento transaction emails and send them programmatically, effectively manage their dispatch or avail of Abandoned Cart Email to get into ear of each type of your targeted customer groups.

According to the statistics, you may find helpfull the following question about newsletter subscription.

How can we help you?

Didn’t you find the answer to your question? We are always happy to help you out.