Email Templates

Email Templates allow you to design, edit, and host HTML email templates.

By storing the template on Mailtrap and calling it via API, you can easily change the template code without committing to your codebase.

Email Templates support Variables, and Mailtrap uses Handlebars as a template engine. You variable should match the {{merge_tag}} in your contact Fields.

You can put {{name}} into your template and, as your contact has a field named "name" with the value "John", the template will display "John". In our visual builder, you'll see a list of your contact fields.

Creating a template

1

Navigate to the Templates menu.

2

Click the Create New Template button.

3

Click the drop-down menu to select one of your domains, enter the Template name, Subject, and Category, and click Continue.

4

Choose the Drag & Drop Editor to build the template without coding, or select HTML Editor if you prefer to write/modify the code.

5

Create/modify the design and click Finish.

The main Templates menu features all your saved templates. To quickly access a saved template, just click on it within the main menu.

Editing and customizing templates

Template details

Each template must have a name, subject, category, and an assigned domain. The subject also supports variables.

Available editors

The drag-and-drop editor allows you to design templates without any coding.

Uploading images

1

Click Upload image in the upper right corner of the Code Editor.

2

Hit the Upload New button in the following menu and choose an image from your local drive.

Image Requirements

  • Supported formats: JPG, PNG, and GIF

  • Maximum file size: 2 MB

3

Once the image is uploaded, you will receive a confirmation notification. If the file format is unsupported or the image is too big, you will receive the corresponding error message.

4

Click the Copy URL button to copy the image URL to your clipboard, then click Template to return to the editing menu.

5

Proceed to add the image to the template body under the <img> tag. You can preview it in the template as soon as the asset is added.

Test Data

Code Editor automatically parses your template and shows all the variables found. The Test Data tab helps you preview the object variables.

By default, as a value, we put a variable name and add the "Test_" prefix.

Sending test emails

If you're using email templates in production, you can send a test email to the account owner's email address to run basic tests. Simply press the Send Test button.

Last updated

Was this helpful?