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.Where you can use variables
Section titled “Where you can use variables”- Text
- Link URLs (on text, buttons and images)
- Image source URLs
- The Code Block
- The subject line
Naming rules
Section titled “Naming rules”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.
How variables are detected
Section titled “How variables are detected”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=variablesreturns 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.
Previewing with test data
Section titled “Previewing with test data”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.
Variables in SendGrid
Section titled “Variables in SendGrid”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.