This is a hypothetical / architectural question, as I haven't come across the need yet.

Let's assume a very simple example: I want to block out certain domains from receiving our emails.

I could use a simple:

Domain(emailaddr) != "google.com" OR
Domain(emailaddr) != "microsoft.com"

Now, this is fine - but imagine i want to grow the list over time, can i store the script in a content block, and then simply use:


This would essentially allow me to scale the exclusion script, making it easier to manage. It would also, introduce a "one fails, all fails" type of build - but for some scenarios and with proper development practices, it might be a good thing.

However - is it feasible?


Yes, I use Content Areas in Exclusion Scripts quite extensively where the Content Area contains 600+ lines of AMPscript code in some situations, but remember that the Exclusion Script still needs to evaluate to true, so in your Content Area you would have something like:

var @result
set @result = [insert here]

The output of @result would be used to determine whether the email would be sent. For example the result could be "email" or "noemail". Then in your Exclusion Script you would use:


Bear in mind that Exclusion Scripts (and referenced content areas) are evaluated in the context of the email, so you can use personalization strings like _subscriberKey, _messagecontext, etc.

You need to be aware of the following:

  1. If you change the Content Area, then you will need to re-publish the Triggered Send, as the Content Area is cached when the Triggered Send is published.
  2. If multiple records exist in the Triggered Send queue, then certain functions are evaluated twice. For example HTTPGet() will be called twice, but Lookup() functions are only evaluated once.
  • Beautiful Eliot ! I assume the same applies to Journey Builder but not Automation Studio sends in terms of re-publishing? :) also, Could you comment on what you mean with multiple records in the triggered send queue? :) maybe a scenario you're thinking of ? – Kenneth Wagner Jun 6 '17 at 16:48
  • I believe that you will need to change an Automation's status to inactive then reactivate it after making changes to an Exclusion Script, as I'm aware that Automation Studio caches all activities when an Automation is activated. For example, if you update a SQL Query used in an Automation, the updated Query Activity won't come into effect until you re-activate the Automation. Regarding your question on Triggered Sends, I'm referring to the 'queued' column in Interactions menu > Triggered Emails. If there is more than one email in the queue, then certain AMPscript functions are evaluated twice. – Eliot Harper Jun 6 '17 at 23:36
  • Interesting - maybe when scheduled yeah, cause when i do manual runs it picks of the latest :-) Thanks for clarifying Eliot :) – Kenneth Wagner Jun 7 '17 at 7:10
  • Run Once will use the latest activities, but when they are activated they will cache. – Eliot Harper Jun 7 '17 at 8:04
  • Hey Eliot - uhm - i might be blind, but can't i use exclusion scripts in Content Builder Sends? – Kenneth Wagner Jun 15 '17 at 12:36

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.