Magento Email Templates Tutorial

How to manage email templates in Magento

Magento sends automatically transactional emails to customers when specific actions are performed. These include welcome messages for newly registered customers, forgot your password messages, order confirmation, shipment confirmation, etc. Magento comes preconfigured with many email templates and each is assigned to be used when one of these actions is performed and an automatic message is sent. From the admin panel of your Magento you can edit the existing templates and add new ones. You can also select which template should be used for a specific purpose (e.g. welcome emails).

To manage email templates log in to the backend of your site and go to System menu>Transactional Emails. On the page that opens there's a table with the templates that you've added and edited. If you haven't added templates it should be empty. Click on the Add New Template button in the upper right corner to add/edit email templates:

Adding an Email Template

On the page that opens there are two panels with settings: Load default template and Template Information.

New Email Template Form

You can create a new template from scratch by typing a name, subject and content for the template in the respective fields in the Template Information panel, or you can base the new template on one of the preconfigured ones by loading it using the settings in the Load default template panel. This is also useful if you just want to edit a preconfigured template; note, however, that a new template will be created anyway, even if you use the same name as the original template. In this sense, strictly speaking you don't overwrite a preconfigured template, instead you create a new one based on it. To do that just select the template from the Template drop-down menu and click on the Load Template button. The fields for Template Subject, Template Content and Template Style will be automatically filled with the information of the default template that you selected:

Loading a Default Template

In our example screenshot above we've loaded the email template (New account) used when sending welcome messages to newly registered customers. You need to type a name for the template in the Template Name field. That's the name that will appear in the various options from which you can select email templates. The value specified in the field for Template Subject will appear in the Subject field of email messages sent to customers. The content of the template is formatted using HTML and also some preconfigured variables. In the message sent to the customer these variables are replaced with the actual values for which they stand. These values are dynamic; for example, the variable {{var customer.email}} is replaced with the actual email address associated with the particular customer.

HTML tags are used to specify how the email message should look in terms of format (e.g. headings, paragraphs, etc.) and to some extent in terms of style (e.g. font style, size, etc.). In the text area for Template Styles which is just under that for the content there's also some code for the style (CSS coding is used).

So in case you want to change the format and style of the template you should have at least some knowledge of HTML. If you want to see how the template will look when sent to customers, click on the Preview Template button in the upper right corner. The values for which the variables stand, of course, will not be shown since at this point the information (e.g. customer name, email address, etc.) is not available. One thing that you can always do even if you don't know anything about HTML is to edit the text that's within the HTML tags. This is also very useful if you have a multilingual store and you want just to translate the text of a default template. You can then use the translated template with the store view of the particular language. After you're done with the changes don't forget to click on the Save Template button in the top right corner of the page.

Now when you go to System menu>Transactional Emails the new template will be listed in the table and you can edit it by clicking on its row in the table:

Editing a New Email Template

You can use these templates and assign them to be used for a particular transactional purpose. For example, if you want to change the template used for welcome emails, for email confirmation messages (if email confirmation is enabled), and for welcome emails that are sent after an email address is confirmed, go to System menu>Configuration>Customer Configuration button in the Customers section on the left, expand the Create New Account Options panel on the right and edit respectively the drop-down menus labeled Default Welcome Email, Confirmation Link Email and Welcome Email:

Changing the Template for Welcome and Confirmation Link Emails

From these drop-down menus you can select any email template that you've added. On the same page there's also the Password Options panel which contains settings for changing the template used for forgot your password emails.

To change templates used for emails for the different sales steps (order confirmation, shipment, etc.) go to System menu>Configuration>Sales Emails button in the Sales section on the left. Each of the panels on the right corresponds to a sales stage (e.g. Order, Order Comments, Invoice, etc.). Expand them and in each you'll see a couple of drop-down menus for changing the email template:

Changing the Email Template for the Sales Stages

One is for the template used for registered customers and the other is for guests (as you know guest checkout in Magento is enabled by default).

There are also some other options for changing the email templates. For example, from System menu>Configuration>Newsletter button in the Customers section on the left you can change the templates used for sending emails for subscribing/unsubscribing to the newsletter.

All these options for selecting templates can be configured per store view. For example, you have a multilingual store with English and French and you want to change the templates for the French store view so that those customers who register through the French store view will receive emails only in French (not the default English ones). Then first you need to go to System>Transactional Emails and edit the particular templates and translate them. After that you have to go to System>Configuration and select the French store view from the Current Configuration Scope drop-down menu in the upper left corner. Once you do that you can edit the options described above for changing the templates.

You can also find information related to email configuration in Magento in the tutorial on how to manage the store email addresses in Magento.