I get how I can exclude a certain email using the below script using the key or email. I'm looking to exclude certain email addresses based on it either containing certain characters or because it starts with certain characters. Example: dummy-37464hvxcs@xyz.com. I'd want to exclude any email that starts with dummy or contains dummy.

ROWCOUNT(LOOKUPROWS("Test_Opt_Out_List","SubscriberKey",_subscriberkey)) > 0

  • If my answer helped solve your issue, please mark it as accepted so others can easily see this has been resolved. Thanks! May 11, 2018 at 8:49

2 Answers 2


If you like to filter based on a subscriber key starting with a certain sting, just put an IndexOf-Check into your exclusion script:

IndexOf(_subscriberkey, "dummy") == 1

If you like to filter out any subscribers that contain "dummy" in the subscriber key no matter where (which most certainly isn't the best idea), you could use the following:

IndexOf(_subscriberkey, "dummy") > 0

The AMPscript that is used in the exclusion script just needs to evaluate to true to exclude the current subscriber from the send. So just check out the string functions in the AMPscript Function Reference and start customizing the script as you wish.

Another option which gives you more control over which email addresses match and which don't is RegExMatch where you can use regular expressions to check if the address qualifies for the send or not:

Length(RegExMatch(_subscriberkey, "^dummy\-.*", 0, "IgnoreCase")) > 0

Further reading:


I would be careful using direct exclusions (e.g. IndexOf(), Contains/Like statements, etc) because it could mean legit emails never get sent.

E.g. Haydummyers@xyz.com would not get your email because it has 'dummy' in it.

As well, if a person has an online alias (notAdummy69@xyz.com) or a business has dummy in its name (mbayter@dummyshop.com) you would exclude them.

It also comes down to the question of "Who are you to judge the legitimacy of personal information a person submits to you?" I believe in most places you are considered 'Innocent until proven guilty' and I think that should apply here as well.

I personally think giving the customer the benefit of the doubt and at least attempting a single send is a far better experience and healthy relationship than automatically excluding them based on preconceived notions.

What you can do to take care of those bad email addresses to ensure deliverability is you check the domains for legitimacy (no @fake.com or @notanemail.com) to prevent hard bounces up front. Then run a daily query or export to find all the soft bounces from the previous day with 'not a real alias at domain' (or whatever the message/code is) and then unsubscribe them.

Through this you would greatly reduce risk (aka damage to sender rep) while increasing value via ensuring all legitimate emails are sent out - essentially creating a greater value to cost, increasing overall ROI.

  • 1
    Awesome. Good to know. We're using random- and feel that's going to be pretty fringe for anyone to have that in their email.
    – J. Pixel
    May 4, 2018 at 13:54
  • Well glad to hear that you read my post and considered it. Although I disagree with your decision, I wish you luck and hope it works out for you. My recommendation (if possible) is to add it as a restriction on the webform submitting this info so that it will prevent the user from submitting it into SFMC rather than ingest it and then block it. May 4, 2018 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.