Disable auto-escaping and display double curly brackets in your emails

In this article, we will explain how to disable auto-escaping within a block and display double curly brackets by using tags in your email templates.

autoescape

By default, Sendinblue escapes the HTML (and JS) content of all variables. This means any HTML passed within a variable will be escaped and printed as text. For example, if your variable content is <h1>My title</h1>, then your template would output exactly this text within your email: <h1>My title</h1> rather than outputting the phrase “My title” formatted as an H1 title.

The autoescape tag controls the current auto-escaping behavior. Since Sendinblue templates autoescape HTML by default, you will need to apply this tag to disable auto-escaping within a particular block. The block should be closed with an endautoescape ending tag.

We will review a common example where disabling autoescape may be useful. Let’s say that you pass products in a variable, but each product requires unique formatting.

If autoescape is used like this:

{% autoescape off %}{{ params.my_html }}{% endautoescape %}

Then, auto-escaping will be disabled for the variable {{ params.my_html }}. Now, if your variable content is <h1>My title</h1>, it will display as an H1 title.

  Input Output
Without the autoescape tag

{{ params.my_html }}

<h1>My title</h1>
With the autoescape tag {% autoescape off %}{{ params.my_html }}{% endautoescape %}

My title

verbatim

Sendinblue Template Language placeholders are formatted as {{ params.variable }} . When using double curly brackets around text {{ like this }} in an email template, Sendinblue will automatically identify this part as a template language element.

The verbatim tag allows you to use double curly brackets in your email templates without them being recognized as a template language element. To escape {{ }} and print these symbols directly in your email, wrap them in this tag:

{% verbatim %}
{{ Print variable }}
{% endverbatim %}

This text will appear fully in your email as: {{ Print variable }}.

⏩ What's next?