In most circumstances, email templates are created during the initial implementation and setup of Optimizely B2B Commerce. However, on occasion, users may need to create a new email template or edit an existing template. It is important to understand that there are two types of scenarios where email templates are used: auto-generated and subscription-based. Auto-generated emails do not have an associated email list, as they are system generated and sent to the appropriate users based on the event, that is Admin_AccoutActivation or OrderConfirmation. Subscription based emails require an associated email list, as they are sent only to those users identified within the list. Therefore, prior to getting started, see the Email Subscriptions article, as it is helpful to understand how subscribers are managed within email lists.
The Default Email Address setting under Administration > System > Settings is used as the "From" address for sending emails when no "from" address has been defined for an email in Marketing > Email Lists.
Creating email templates
By default, email templates are only exposed in the Email Template list after they have been triggered during an event on the website. For example, the OrderConfirmation template would only display after the first order has been submitted. After implementation, some templates will be exposed as a result of testing. However, as a website administrator, it is possible to manually generate any missing email templates and not wait for the system to create one during the course of operations. As a technical side note, DotLiquid is used to render the views of all email templates.
If you have old email templates from a previous version of B2B Commerce (4.2 and prior), they will need to be either deleted or renamed, which will force the generation of updated templates using DotLiquid, rather than Razor. These new templates can be used as guides for how to correctly format the templates using DotLiquid. Any existing email templates will then need to be converted to use the DotLiquid format.
Steps to Manually Generate an Email Template
- Go to Admin Console > Marketing > Communications > Email Templates.
- Click Add Email Template.
- Select the desired template from the Template menu.
- Select which websites can use the template from the Website menu.
- Click Create.
- If New Template was selected from the menu in the Template field, the New Template screen will be displayed. Enter the template name, description, targeted websites and click save. Then continue on to the Editing an Email Template section below, starting with step 3.
Editing an email template
It is possible that not all available email templates will be exposed via the Admin Console, as they first need to have been triggered by the qualifying activity. For example, the Order Confirmation template would only be shown after an order has been completed and the email has been sent. However, typically most templates will have been tested and triggered during the implementation phase of B2B Commerce and therefore exposed in the Admin Console.
- Go to Admin Console > Marketing > Email Templates.
- Click Edit for desired template.
- Click Create Revision to edit the HTML. Do not modify the variables in the HTML code. Refer to the HTML Variables for Email Templates article for additional information.
- Click Save after the changes have been made.
- Click Publish.
- Choose when the content should be published and then click Publish.
Creating an email list and assigning subscribers
If the newly created template is intended for email subscribers, a new Email List may need to be created if existing one does not fit the use case.
- Go to Admin Console > Marketing > Communication > Email Lists.
- Click Add Email List.
- On the Details finger tab populate the Name, Description, select the desired Email Template, Subject, and From Address.
- Click Save.
The Manage Subscribers finger tab can only be accessed after the new Email List has been saved- only the Name field is required to save the list.
- Go to the Manage Subscribers finger tab.
- Click the Assign Email to Subscribers to add desired emails to the list.
This list is populated when users click the Subscribe radio button found on the website under MyAccount > Account Settings.
- Select the Email Addresses to be added to the subscription.
- Click Assign and click Done.