If/Then Query based on sender email address

Seeking how to format a rule so that it ONLY processes if sent from domain1 OR domain2. If not 1 of these 2 email domains then STOP rule set command would run.

Tried using the OR comment but is stopping even if sending from 1 of those domains.

Thank you!

You want an AND with a DOES NOT CONTAIN like this:

@ScottGordon

Thanks for posting here!

I will directly answer your question below, but first let me explain the expression builder as a whole.

Using a simple expression (with no nested sub-expressions), the and/or selector at the top tells whether any of the stanzas need to be true, or all of the stanzas need to be true, for the expression as a whole to be true.

Example 1:

For example, this will be true if the sending domain is example.com OR if the subject line begins with This is urgent:

In this example, if either of the two stanzas are true, then the entire expression will be true.

Example 2:

For another example, this will be true if the sending domain is example.com AND if the subject line begins with This is urgent:

In this example, if BOTH of the stanzas are true, then the entire expression will be true.

Example 3

Let’s expand the first example. If we add a bunch of stanzas, it still only takes 1 “true” stanza for the entire expression to be true:

In this example, if ANY of the stanzas are true, then the entire expression will be true. If the sender’s domain name is example.com, it will be true. If the subject line begins with This is urgent, the expression will be true. If the subject line begins with This is an emergency or if it begins with This is important , etc, it will be true.

It takes just one true stanza for the entire expression to be true (because we are using OR as the selector at the top).

Back to your question

Back to your original question, the expression you provided will always be true, 100% of the time. The email will always “not contain” domain1.com OR “not contain” domain2.com. It will always not have one of them, so the expression will always be true.

When using “does not…” operators, you almost always want to use and, as @KeithTessler so helpfully added.

Also, a suggestion: instead of using “does not contain”, I recommend using “does not equal”. This will ensure the entire domain matches (i.e. stable.com contains able.com, but is a different domain).