Time to read: 1 mins.


We use the jinja2 templating engine to render your templates, and create the html or text body of the email.

A template contains variables which are replaced by values you send in the create message request, the result is then rendered as the content of the email.

Example template

The example below shows how to build the template welcome_aboard.html by using template inheritance. This is a powerful feature as it allows you to separate a template into multiple reusable pieces.

For an over of the features that we support for templating, please take a look a the Jinja2 template designer reference manual

  1. welcome_aboard.html (the main template)
  {% extends layout.html %}
  {% block content %}
    <p>Hey {{ user.firstName }}</p>
    <p>Thanks for signing up!</p>
    {% if user.isConfirmed == false %}
      <p><a  class="confirm" href="{{ user.confirmLink }}">Please confirm your email address</a></p>
    {% endif %}
  {% endblock $}
  1. layout.html
      <style type="text/css">
        {% inclue 'style.css %}
      {% block content %}
  1. style.css
.confirm {
  font-weight: bold;