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
Navigate to the Templates menu.

Click the Create New Template button.

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

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

Create/modify the design and click Finish.

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.

The Code Editor allows you to edit the HTML or text content, depending on the emails you want to send.

The editor supports Find and Replace options, and you can use Cmd+F or Win+F as a hotkey to reveal a quick search bar.
Template Validation
If your template has an error, Handlebars cannot render it. You'll see an error message in the Preview tab, and the RAW code with an error will be highlighted in the Editor.
You can't save a template with errors. Note that we don't validate HTML — only Handlebars syntax is validated.

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

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

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.

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

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.

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.

Test email requirements
Your domain must be verified to send a test.
Each test email is billed over your quota.
Last updated
Was this helpful?

