Templates
A template is a reusable layout for campaigns and automation emails. It is different from a saved transactional email, which you manage under Transactional.
On this page
Creating a template#
Open Templates and click “Create template”. Your team’s template editor controls the layout editor. The content editor controls writing inside that layout’s editable fields. Choose these in the team’s editor settings before creating drafts; switching editors can lose content.
Slots#
A slot is an editable field in a layout. Put its name between triple brackets. This minimal HTML template has one field named content:
<!doctype html> <html> <head><meta charset="UTF-8"></head> <body> <main>[[[content]]]</main> <p><a href="{{ unsubscribeUrl }}">Unsubscribe</a></p> </body> </html>
Save the template, select it when creating a campaign, and write into its content field. Templates without slots copy their full HTML into the email instead.
Slots such as [[[content]]] define fields you fill while writing. Recipient placeholders such as {{ subscriber.first_name }} are replaced when sending. They serve different purposes; see campaign placeholders.
MJML#
MJML is a markup language for responsive email layouts. Use the HTML/code template editor, which uses CodeMirror for syntax highlighting. Both the template and slotted content must contain valid MJML when using MJML slots.
Using the API#
Use the Templates API to create or retrieve a template. Its UUID is a unique resource identifier, not its numeric database ID. Pass that UUID as template_uuid and slot values as fields when creating a campaign.