How can I filter messages in Gmail using boolean
OR conditions? For example, I can specify addresses in the
From: fields, but this only matches emails that meet both criteria. How can I match emails that meet one or both criteria?
Type into the search field of Gmail:
from:xyz OR to:uvw
see also here.
to make a filter (and apply actions to that filter) from that search: click the little down arrow on the right side of the search field and then click
create filter with this search.
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
firstname.lastname@example.org in the To field, it'll create the filter condition
to:(email@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.
- Create or modify a filter.
- In the Has the words field, enter your
ORcondition. For example:
to:firstname.lastname@example.org OR from:email@example.com
This is also the place to put any other attributes you want to match (e.g.
This will also work in the Show search options page, however it's easier to just use a normal search instead.
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.
firstname.lastname@example.org | email@example.com | firstname.lastname@example.org`
The search box would look like:
to:(email@example.com | firstname.lastname@example.org | email@example.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.