Skip to content

Variables

Variables are placeholders for data you fill in when you send an email, such as a customer’s name or an order number. Write them in double curly braces:

Hi {{first_name}}, your order {{order_id}} has shipped.
  • Text
  • Link URLs (on text, buttons and images)
  • Image source URLs
  • The Code Block
  • The subject line

A variable name can contain letters, numbers, underscores and hyphens, with no spaces: {{first_name}}, {{orderId}}, {{plan-name}}.

Text that does not match these rules, such as {{ first_name }} with spaces, is not treated as a Maiilo variable and is shown as literal text.

Maiilo detects the variables in a template automatically. When you publish, the list of variables is frozen with the version, alongside its HTML and subject. You can see it in two places:

  • The Variables tab of the Export dialog.
  • The API: GET /api/v1/templates/:id?format=variables returns only the variable list. See Get template by ID.

Maiilo never fills in variables itself. Your application or your ESP replaces them at send time.

The Preview dialog has a Test data panel. Enter sample values to see the email as a recipient would. Test data stays in your browser and is not part of the template.

Maiilo’s {{variable}} syntax is the same as SendGrid’s, and Maiilo pushes templates as SendGrid dynamic templates, so your variables work in SendGrid as you wrote them.

SendGrid uses Handlebars, which treats a few brace patterns as instructions where Maiilo shows them as literal text, such as {{#if}} blocks or an unclosed {{. See Your variables in SendGrid.