Using Email Layouts

Last edit: 

Contributors: 

This guide will help you provide a layout for your email notifications.

Requirements

As the concept of an email layout is the same as the concept of a layout for pages, you should understand the concepts of layouts and notifications, and should have created an email notification before.

Steps

Using email layouts is a two-step process:

  1. Create email layout file
  2. Edit email layout file

Step 1: Create email layout file

The default layout file for all emails should be located in the views/layouts directory. Create a file named mailer.html.liquid.

Step 2: Edit email layout file

The content of an email layout is slightly different from the content of a layout for pages, because it needs to be marked as an email layout.

Add the following to your email layout file mailer.html.liquid:


  Header

  {{ content_for_layout }}

  Footer

Where {{ content_for_layout }} injects the body defined in the email notification into the layout. Without it, you would be sending a layout without actual content.

Next steps

Congratulations! You know how to use email layouts. Now you can learn about creating an SMS notification.

Questions?

We are always happy to help with any questions you may have. Check out our Help page, or contact us.