Emil Genov bio photo

Emil Genov

Software developer living in Barcelona

LinkedIn Github Stackoverflow
The problem: I want to forward all of my mail to other email account (for example my cell phone Email2SMS address). I want to be able to filter some of the messages using gmail filters, and I do not want to forward those filtered messages.

Problem is that gmail, first forwards messages and after that applies filters, just the opposite of what I need.

Solution: Well it's a little convoluted but it works. What I needed, was a forwarding filter that will will forward mail coming from any address, except those from a specific list.

As it took me some time to figure out the right syntax (try and error), I decided to write it down for someone who will need it too.

You can use two filters, first filters unwanted mail, second forwards wanted ones:

1) Matches: from:(not_wanted1@mail.com | not_wanted2@mail.com | not_wanted3@mail.com)
Do this: Skip Inbox, Mark as read, Delete it

2) Matches: from:(-not_wanted1@mail.com,-not_wanted1@mail.com,-not_wanted1@mail.com)
Do this: Forward to you-address@sms.mtel.net

So syntax for filter that matched mail send from any address, except those from a specific list is like this: put a minus in front of address and use comma as list separator. Hope this will help someone, write comment if this got the things done.