65

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

I'm trying things like from:address1@gmail.com and not from:address2@gmail.com and from:(address1@gmail.com and not address2@gmail.com)

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

Anyone has any idea?

  • 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 Sep 24 '12 at 12:29
69

The 'or' function in Gmail is represented by 'OR,' and the 'not' function is represented by a minus (-). You also can use quotes (" ") to specify an exact phrase.

From the Gmail help page on Boolean operators.

  • And the AND operator? Does just adding 2 restrictions make it an AND by default? – Steven Roose Sep 24 '12 at 12:15
  • 5
    AND is the default. – Asa Aug 14 '13 at 14:42
  • 3
    I have the feeling that the default is OR, because I got results from both words not together – logoff Oct 11 '16 at 8:25
  • 2
    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 May 1 '17 at 15:05
  • Note that you need to use double quotes " when specifying exact phrases. I got weird results using single quotes '. – Tim Malone Jun 28 '17 at 0:17
13

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:name@company.com -from:name2@company.com

or you can do things like

is:unread -in:spam -in:trash
6

For not in Google, use -, like so:

from:addres1@gmail.com -address2@gmail.com
  • 1
    from:-address@example.com doesn't seem to work for me when there are multiple messages in the same "conversation". Since SOME of those messages were NOT from address@example.com, it consider it a match and moves the ENTIRE conversation, even though one of the messages WAS from address@example.com 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 Dec 27 '12 at 18:36
5

This will work:

from:@company1.com -address2@company1.com

This puts all messages from any sender at company1.com into a folder except those from the individual address2@compay1.com.

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

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

-("phrase one" OR "phrase two" OR "word1")
  • 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 Jul 4 '18 at 12:52
  • 1
    Is this equivalent to -{"phrase one" "phrase two" "word1"}? – Marcel Wilson Jan 22 at 18:38
  • @MarcelWilson it is not the same, having the OR in between the words is required logic. – Peter W Feb 5 at 15:10
  • 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? – Marcel Wilson Feb 5 at 15:15
  • 1
    @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 Feb 5 at 16:46

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