Skip to main content

Prevent email sending to specified domains

Exclude sends to a particular organization or inbox provider.

Updated over 2 weeks ago

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

Exclude a single domain

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;

}

}

}

Exclude multiple domains

To check for multiple domains within the person's email address, add additional values to the end of the excludedEmailSuffixes 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?