Use {% abort_message %} to cancel a message and prevent it from being sent.
Syntax
All four forms are valid.
{% abort_message "reason" %}
{% abort_message 'reason' %}
{% abort_message("reason") %}
{% abort_message('reason') %}You can use it as follows without a reason (defaults to "Template aborted").
{% abort_message %}How does it work?
The message is not delivered.
The abort reason is logged for debugging.
Content after the tag is not rendered.
This is a controlled cancellation, but not an error.
Common patterns
You can abort if the required data is missing.
{% if email == blank %}
{% abort_message "No email address on file" %}
{% endif %}
{% if name == blank %}
{% abort_message "Missing user name" %}
{% endif %}You can abort based on the user state.
{% if c_loyalty_tier == blank %}
{% abort_message "User not enrolled in loyalty program" %}
{% endif %}
Hello {{ name }}, your {{ c_loyalty_tier }} member offer is inside...You can abort when the personalised data is unavailable.
{% if c_last_purchased_product == blank %}
{% abort_message "No purchase history for replenishment campaign" %}
{% endif %}
Still stocking up on {{ c_last_purchased_product }}?You can apply multiple guard checks at the top.
{% if email == blank %}{% abort_message "No email" %}{% endif %}
{% if name == blank %}{% abort_message "No name" %}{% endif %}
{% if c_loyalty_tier == blank %}{% abort_message "Not a loyalty member" %}{% endif %}
Hello {{ name }}, your exclusive {{ c_loyalty_tier }} offer awaits...The abort reason string is recorded in the message activity log. You can use descriptive reasons to make debugging easier.