130

I'm trying to find mails that have one address in the recipients but another not in it.

I'm trying things like from:[email protected] and not from:[email protected] and from:([email protected] and not [email protected])

None of them work, and I can't find a good help page about boolean operators either.

Anyone has any idea?

2
  • 1
    Actually, your search doesn’t make much sense—you can’t receive an email from more than one recipient, so form: someone but-not-from: someone else can’t really work. You are probably trying to search for emails that were sent only to a restricted group of recipients.
    – Alex
    Commented Sep 24, 2012 at 12:29
  • 1
    I couldn't find an exact answer for this but what worked for me was using double quotes to cause the AND operator functionality. So with reference to OP's from:"[email protected]" NOT from:[email protected] should behave like AND
    – Anupam
    Commented Jul 6, 2021 at 6:34

5 Answers 5

136

The 'or' function in Gmail is represented by 'OR'. You also can use quotes (" ") to specify an exact phrase.

From the Gmail help page on Boolean operators.

The 'not' function is represented by a minus (-), like -from:(...), -{from:(...)}, or -(from:(...))

6
  • 2
    And the AND operator? Does just adding 2 restrictions make it an AND by default? Commented Sep 24, 2012 at 12:15
  • 8
    AND is the default.
    – Asahiko
    Commented Aug 14, 2013 at 14:42
  • 7
    I have the feeling that the default is OR, because I got results from both words not together
    – logoff
    Commented Oct 11, 2016 at 8:25
  • 8
    The robustness is pretty awesome actually, and you can negate whole subexpressions; I frequently search unread email not from a list of senders: is:unread -{ from:a from:b ... }
    – Dan Lugg
    Commented May 1, 2017 at 15:05
  • 1
    Note that you need to use double quotes " when specifying exact phrases. I got weird results using single quotes '.
    – Tim Malone
    Commented Jun 28, 2017 at 0:17
32

Use the minus sign to make a negative rule. You can also string rules together by just leaving a space between separate rules.

For example:

from:[email protected] -from:[email protected]

or you can do things like

is:unread -in:spam -in:trash
9

For not in Google, use -, like so:

from:[email protected] [email protected]
3
  • 3
    from:[email protected] doesn't seem to work for me when there are multiple messages in the same "conversation". Since SOME of those messages were NOT from [email protected], it consider it a match and moves the ENTIRE conversation, even though one of the messages WAS from [email protected] so I would like the entire conversation to stay in the inbox... It's really tricky when Gmail tries to group things into conversations based on message similarity of subject/body! I wish the REPLIES to these messages could show up in my inbox even though the ORIGINALS got archived...
    – Tyler Rick
    Commented Dec 27, 2012 at 18:36
  • 1
    @TylerRick I have the exact same problem than the one you described here. Any idea since 2012? ;)
    – Basj
    Commented May 2, 2020 at 17:48
  • @Basj In conversation view if any message matches the search the entire conversation will be returned. Either switch of conversation view temporarily or use a different approach.
    – Blindspots
    Commented Jun 7 at 20:52
8

when trying to avoid multiple phrases in a subject line for selection:

-("phrase one" OR "phrase two" OR "word1")
5
  • 1
    This is the best answer. You can combine with brackets like this: -from:(gmail.com OR google.com) This will filter all emails from anybody at gmail.com or google.com
    – user643011
    Commented Jul 4, 2018 at 12:52
  • 6
    Is this equivalent to -{"phrase one" "phrase two" "word1"}? Commented Jan 22, 2019 at 18:38
  • 1
    @MarcelWilson it is not the same, having the OR in between the words is required logic.
    – Peter W
    Commented Feb 5, 2019 at 15:10
  • 1
    I'm confused then. My understanding of the curly braces is all items contained within are OR'ed. While the parenthesis is a grouping, which if all items are OR'ed would mean they would be equivalent? Am I being dense? Commented Feb 5, 2019 at 15:15
  • 7
    @MarcelWilson I spoke too soon - you are correct, I wasn't paying attention to the curly braces. According to the documentation curly braces replace the need for OR inside of parentheses.
    – Peter W
    Commented Feb 5, 2019 at 16:46
6

This will work:

from:@company1.com [email protected]

This puts all messages from any sender at company1.com into a folder except those from the individual [email protected].

1
  • 1
    This is exactly what I was looking for and works great! I'm not sure why someone downvoted you.
    – Hexxagonal
    Commented Dec 9, 2015 at 16:01

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