Tell me more ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

How can I filter messages in GMail using boolean OR conditions. For example, I can specify addresses in the To: or From: fields, but this only matches emails that meet both criteria. How can I match emails that meet one or both criteria?

share|improve this question

3 Answers

up vote 13 down vote accepted

Type into the search field of Gmail:

from:xyz OR to:uvw

see also here.

share|improve this answer
Thanks. You've saved me a lot of frustration. I have a friend who doesn't know about the BCC field and likes to email TONS of people who like to reply-to-all. – jessegavin Jul 19 '10 at 17:49

If you are talking about searching, then @akira's question is correct. However, it sounds like you are asking about how to use this condition in a filter.

The trick is that you can put whatever search criteria you want in the filter's Has the words field. For any other field it will prefix your criteria with the field name. For example, if you type user@example.com in the To field, it'll create the filter condition to:(user@example.com). The reason it works in the Has the words field, is because it doesn't prefix it with anything. This is because it acts as a normal search on the content of the email.

  1. Create or modify a filter.
  2. In the Has the words field, enter your OR condition. For example: to:user@example.com OR from:user@example.com

This is also the place to put any other attributes you want to match (e.g. label:, in:, etc.).

This will also work in the Show search options page, however it's easier to just use a normal search instead.

share|improve this answer

To my surprise, the solution to me was using the vertical bar | between emails instead of the comma , in the TO filed during filter creation.

Example:

name1@domain.com | name2@domain.com | name3@domain.com`

The search box would look like:

to:(name1@domain.com | name2@domain.com | name3@domain.com)

I got a popup message from Gmail saying that using special characters may give unexpected results. Just clicked on continue and it worked perfectly.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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