Skip to main content
All CollectionsTriggersAdvanced trigger control
Prevent email sending to specified domains
Prevent email sending to specified domains

Exclude sends to a particular organization or inbox provider.

Updated over a year ago

The following code snippet, added to the Script that controls whether this trigger program is run field of a trigger program, prevents the trigger from sending to the person if @yourdomain1.com is part of their email address.

var excluded_email_suffixs = ['@yourdomain1.com'];

result.proceed = true;

if (person && person.email) {

for (var i = 0; i < excluded_email_suffixs.length; i++) {

if (person.email.indexOf(excluded_email_suffixs[i]) > -1) {

result.proceed = false;

}

}

}

You can check for multiple domains within the person's email address by simply adding additional values on to the end of the excluded_email_suffixs array. For example:

var excluded_email_suffixs = ['@yourdomain1.com','@yourdomain2.com'];

result.proceed = true;

if (person && person.email) {

for (var i = 0; i < excluded_email_suffixs.length; i++) {

if (person.email.indexOf(excluded_email_suffixs[i]) > -1) {

result.proceed = false;
}
}
}

Did this answer your question?