Transactional email: Transactional email templates - Magento 2

Learn to create transactional email templates in Magento 2. 

Overview

Creating Magento transactional templates is now a quick, simple and intuitive process by utilising Dotdigital's EasyEditor.

It's important to note that these emails are not triggered out of Dotdigital directly. Instead, the source of the campaign is synchronised back to Magento every six hours once mapped via the 'Dotdigital for Magento' connector. After synchronisation is complete the campaigns become available under 'Transactional Templates' within Magento and replace the default templates that were selected previously.

For more information and guidance about Dotdigital's transactional email service, read Using transactional email.

Before you start

Things you need to know:

  • Transactional email templates are supported only by Magento v2.2.0 and above, and by Dotdigital for Magento v2.4.4 and above.

Replacing default email templates with Dotdigital campaigns

  1. Go to Stores > Configuration > Dotdigital > Transactional Email
    image__1_.png
  2. For the appropriate Magento email template, select a campaign from the dropdown next to it (a triggered campaign type is recommended but you can select from any)
    mag2_select_campaign_for_default_template.png
  3. Select Save Config

This will automatically cause your template synchronisation to run (it normally runs every 6 hours and can be run manually by going to Developer > Sync Settings), which will do the following:

  • In MARKETING > Email Templates (under the 'Communications' section), a new email template will be created for the template which was mapped to in step 2
    mag2_marketing_email_templates_created.png
  • the Dotdigital campaign's content will be copied into the new email template 
  • the Dotdigital campaign's subject line will be copied into the new email template's subject
  • the Dotdigital campaign's 'From address' and 'Friendly from name' will be copied to the correct location in Magento admin

Using Magento variables

You can make use of any official Magento variables in your campaign, provided they're placed inside Liquid raw tags within a text box building block. This makes sure the variables aren't misinterpreted as Liquid when the campaign is compiled, therefore will be formatted correctly in Magento.

Email subject line

If you're entering tags into the email subject line, you must remove any raw tags, as the variable works without them.

M1_code_block_raw_campaign.jpg

Here are some examples:

Gets the customer's first name

{% raw %} {{var customer.firstname}} {% endraw %}

Gets the payment method used

{% raw %} {{var paymentMethod}} {% endraw %}

Gets the first line of the shipping address

{% raw %} {{var order.getShippingAddress().getStreet1()}} {% endraw %}
Read more about Magento variables and customising email content »

Restrictions

Email templates sent using an Dotdigital campaign don't support the following EasyEditor features, building blocks and link types:

  • Personalisation
  • Product recommendations
  • Emojis
  • 'RSS feed'
  • 'Sharing'
  • 'Social links'
  • 'Dynamic content'
  • 'External dynamic content'
  • 'Advanced personalisation' blocks
  • 'Forward to a friend' link
  • 'Unsubscribe' link (but you will need to include one in order to save your template in EasyEditor; see 'About unsubscribe links')
  • 'View in browser' link
  • 'Double opt-in' link

Don't make use of these types of features, blocks or links in your transactional email template, otherwise your email won't render correctly.

Did you find this article helpful?

Can we help?

Thanks for using Dotdigital. If you need more help or support, then contact our support team.