Prerequisites
Personalize the message
1
Write the template
Put this in an email block in , or create the template in code with the :Four helpers are doing the work:
datetime-format takes the timestamp, a strftime format, and a timezone. Passing profile.timezone means every customer reads the time in their own zone. Guard it with #if rather than default, since an empty string isn’t a date either.Anything prefixed with profile. comes from the stored profile. Everything else comes from data on the send.2
Send the data it fills in
Verify
1
Read what arrived
2
Compare it against the data you sent
Open , find the
requestId, and read the rendered message next to the data that produced it.Handle a missing value
A variable you only print is safe to omit: a missing single-brace variable renders as the literal{tax}, and a missing Handlebars var renders empty. The greeting’s default helper turns that empty render into “there” instead of a blank name.
A variable a helper computes with isn’t safe. Send the template above without tax and add produces NaN, format throws, and the whole message fails with undefined is NaN. The status is UNDELIVERABLE, and nothing is delivered on any channel. The send still returns 202 with a requestId, so the only place this surfaces is the message status.
Two helpers in this template need guarding, and they need different guards:
The total above applies that guard:
{tax} left in the rendered output, not a {{tax}} that rendered empty, so the default above is still what protects you. has the full behavior.