×
Login or create an account
If you have an account with us, please log in.

You have no items in your shopping cart.

Magento 2 email templates

Instead of customizing default email templates 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 templates as physical files in your theme or create them using the Admin Panel. We are going to describe how to create the templates via the Admin Panel. 

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

Keep in mind that any custom templates created via the Admin Panel have priority over default or theme-based templates.

  • 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.

Template Information

Template Name: enter the name you want to identify the template in the Admin Panel;
Template Information: fill in the subject of the 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 customized email template in Magento 2?

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

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

sales-emails-magento

  • In the Order drop-down menu 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.

Email hacks for Magento 2

email templates location

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

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.:

{{if logo_width}}
width="{{var logo_width}}"
{{else}}
width="100"
{{/if}}

{{if logo_height}}
height="{{var logo_height}}"
{{else}}
height="50"
{{/if}}

  • 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. 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

You can implement the Follow Up Email extension to easily customize follow-up email templates and effectively manage their dispatch or avail of Abandoned Cart Email to get into ear of each type of your targeted customer groups.

Rate the answer?
Back to top