Template Blocks allow you to leverage HTML, CSS, and Handlebars templating for highly customized email notifications in Courier. Template Blocks provide a powerful way to create dynamic, richly formatted content for your email notifications. They combine the flexibility of HTML and CSS with the dynamic capabilities of Handlebars templating.

Plain Text

Plain text preview is not supported for template blocks at this time. Anything created with template blocks will not render as plain text in emails.

Template Block Boilerplate

Email Client Support

HTML and CSS support varies by email client.

Handlebars Templating Language

The Template Block supports Handlebars. You can learn about the language syntax from the Handlebars Language Guide.

Read more: Custom Courier Handlebars helpers.

Styling with CSS and Handlebars

Combine CSS and Handlebars for dynamic styling:

Template Block with CSS and Handlebars

Using Markdown in a Template Block

Render markdown between {{#markdown}} and {{/markdown}} within a template block.

<div>
{{#markdown}}
  # Your Markdown Content

  - List item 1
  - List item 2
{{/markdown}}
</div>

Using Replacement Variables in Handlebars

Insert variables from your JSON event data:

{{var "variable_name"}}

Read More:

Inserting HTML from Variables

To render HTML stored in a variable, use triple curly braces:

{{{htmlContent}}}