Using Email Layouts

Last edit: Mar 20, 2020

This guide will help you provide a layout for your Email Notifications.


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.


Using email layouts is a three-step process:

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:


{{ content_for_layout }}


Where {{ content_for_layout }} injects the body defined in the Email Notification into the layout. Without this part, you would be sending a layout without actual content.

Step 3: Use layout in email

To use the newly created layout in your Email Notification, set layout_path:

layout_path: mailer

Next steps

Congratulations! You know how to use email layouts. Now you can learn about including attachments.


We are always happy to help with any questions you may have.