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 is not 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. That silence is why the default on the greeting matters.
A variable a helper computes with is not 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:
So guard every variable a helper computes with, and reserve the bare form for text you are only printing. That is why the total above is written:
{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.