Sendwithus templates allow HTML to be passed into variables. To prevent HTML from being passed into a template ‘escape’ the HTML characters by converting them to HTML safe alternatives as templates do not auto-escape HTML by default.

Escaping HTML

Sanitizing text before passing it to a template is the safest method to ensure unwanted HTML stays out of your emails. If you need to escape HTML in a template you can use our templating language Jinja:

Jinja Escaping Methods

  • Use the escape filter on variables which may contain unwanted HTML.
  • Enable auto-escaping for the entire template by wrapping its content in auto-escape tags.

Jinja Autoescaping Tags Example

{% autoescape true%} 
    Auto-escaping is active within this block. 
    Place template content here and all variables will be auto-escaped by default.
{% endautoescape%}