I'm working for a nonprofit that serves people charged with federal crimes. We track their cases online using a system that sends an email to us every time something happens in their case. That's a huge amount of email though, and up to this point we've only really cared about sentencing hearings.

So, I currently have our Gmail account set up with the following filters:

Matches: from:([email protected]) sentencing
Do this: Apply label "Sentencing Update", Never send it to Spam, Categorize as Primary
Matches: from:([email protected]) -sentencing
Do this: Delete it

We've decided we also want to get emails that contain the phrase "Trial held." I'm pretty comfortable creating the filter that would get something with that phrase into my inbox and labeled, but I'm less clear on how to update the deletion filter. It seems to me there are two options for NOT/- filters with multiple queries:

  1. delete everything that contains both queries
  2. delete everything that contains either query
  3. delete everything that contains neither query

I want option number three. What should the filter look like? I could see 1 or 3 being what happens when you use an AND operator and 2 and 3 happening when using an OR operator...

  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community
    Sep 7, 2021 at 18:31

1 Answer 1


To DELETE ALL emails from [email protected] EXCEPT ones that contain "sentencing" AND/OR "Trial Held":

from:([email protected]) -{"sentencing" "Trial Held"}


  1. Putting curly braces "{}" around terms implies OR for it's contents.
  2. If you don't put quotes around a singular word google can return pluralizations. e.g. sentencing = sentencings You can also use the plus "+" sign in lieu of quotes:

from:([email protected]) -{+sentencing "Trial Held"}

  1. You need quotes around "Trial Held" if you are only looking for instances where they show up side by side.

  2. If your system is putting tags in the subject line then you can restrict the search to subjects to avoid unforeseen errors:

from:([email protected]) -{subject:("sentencing") subject:("Trial Held")}

Warning: I would be inclined to archive and label the offending emails (instead of immediately deleting them) since (1) they can be deleted en-masse at any point. (2) the storage is not a concern, (3) they don't need to be seen or sync'ed and (4) perhaps more importantly, while "you" may not be prone to errors or oversights, keep in mind you are getting advice from "me", who is, so I encourage you to be careful when deleting even if you really really know what you are doing. :-)

  • Thank you! For the record, I'm not concerned about deleting messages since any information in them is redundant to the web app. I just use the emails as an alert system to check the web app for more info. And, as I'm learning in my personal gmail account, storage is expansive, but not unlimited...
    – JPTiger
    Sep 13, 2021 at 19:29
  • Makes sense on all counts @JPTiger.
    – Blindspots
    Sep 14, 2021 at 21:16
  • Added a note today about optionally replacing spaces by periods in word pairs rather than quotes.
    – Blindspots
    Sep 27, 2021 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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