If the statement evaluates to true, the transactional email will not send.

 cancel( mixed input )

If the cancel statement evaluates to true for that subscriber, and the statement exists in the Setup field of the template, then the email will not send.



If the subscriber does not have an incomplete purchase, then the statement is true and the send will be cancelled.

Cancel Confirmed Opt-In if User Exists on List

Use Case: Cancel a Confirmed Opt-In email if a user already confirmed their list status.


{cancel(contains(profile.lists, "Master List"), "User is on the Master List")}

Result: Email will not send. If you preview and meet the cancel criteria, you’ll see this message.

zephyr example error occurred failed assert user is on the master list

Explanation: This script uses contains() to check which list memberships are on an individual user’s profile. If a specific Natural Lists is in that array, the cancel() function will prevent it from sending.

Cancel Send Based On User Var

Use Case: Cancel a Welcome Email if a user has already received the template. A var indicating the user has received the email can be set using triggers and the api_user() function.


{cancel(profile.vars.welcome_received == true, "User has received the Welcome Email")}


zephyr example error occurred - failed assert - user has received the welcome email

Email will not send. If you preview and meet the cancel criteria, you’ll see this message:

Explanation: This script uses cancel() to prevent a send from going out by performing an evaluation on the “welcome_received” custom field (var) and checking if the value is “true”.

Cancel Abandoned-Cart Series if Cart Emptied

Use Case: Cancel a follow up abandoned cart email if there’s nothing in the cart.


{cancel(profile.purchase_incomplete == null, "User's cart is empty.")}

Result: Email will not send. If you preview and meet the cancel criteria, you’ll see this message:

zephyr example - failed assert - user cart is empty

Explanation: This script performs an evaluation of the user’s current incomplete purchases. If it evaluates to null–i.e. there’s nothing currently in the user’s cart–the cancel() function will stop the send. Beneficial for follow-up emails in an Abandoned Cart series.

Cancel and Resend Template Based on a Date (Avoiding Weekends)

Use Case: You have a certain transactional (such as a Welcome email) that you don’t want going out on the weekends. Instead, you’d like it to go out the following Monday.


In the Setup:

{cancel(date("EEEE", time('now')) == "Saturday" || date("EEEE", time('now')) == "Sunday", "It's the weekend")}

In the Trigger:

Event: On Cancel
Time: 0 minutes
Action: Custom Zephyr:

{if date("EEEE",time('now'))=="Sunday"}
{api_send({'template':Welcome:', 'schedule_time':date("EEEE, MMMM d, yyyy hh:mma",time("+24 hours"))})}
{else if date("EEEE",time('now'))=="Saturday"}
{api_send({'template':Welcome:', 'schedule_time':date("EEEE, MMMM d, yyyy hh:mma",time("+48 hours"))})}


This script uses the time() function to return the timestamp of the current day and time, which the “date” function converts to a human readable value. Then using the cancel() function, an evaluation is made to check if the value equals “Saturday” or “Sunday”. Note: The double pipe  (“||”) acts as on “OR” statement.

Assuming that this is the only cancel() statement within the template, a script is triggered in the “Triggers” tab on event send. Using an “if” statement, and similarly using the date() and time() functions, a check is done to see which day it is. If it’s Sunday, the api_send() function will queue the template to resend itself in 24 hours (i.e. on Monday) at the current time. So if the template canceled at 12:30PM on Sunday, it will resend at 12:30PM on Monday. Similarly, if the template canceled on Saturday, api_send() will queue it to resend to the user in 48 hours, i.e. the following Monday.