# Gmail/Filters

Overview — Introduction — Facts — Basics — Advanced — Last tips — Other
Filters can filtrate your incoming mails, and put them into labels, archive them automatically or delete them.

## Create a filter

When you make a filter you click the little "Create Filter button" beside the search bar. Now you see a big yellow box, where you can choose what the massages have to contain or be like, should it filtered or not. If you click the test search button you can see what messages it will filter. After choosing the options you click the "Next Step" button.
You will see a new box, here you choose the action of the filter. Here is a description of the actions:
* "Skip the inbox" The message will be archived (Gmail version of "archived" - see below)
* "Star it" Give the message a star.
* "Apply the label" Puts the message into a label.
* "Forward it to" Forward the mail to another Mail account.
* "Move to deleted items" Delete the message.
Note: when you "archive" a message, all this means is the messages has its "Inbox" label removed. It does not changes its read/unread status etc. So, in the second screen, using "Skip the Inbox" with "Apply the Label:[ ]" would move incoming mail matched by the filter automatically into a separate "folder" in Outlook speak. If the message is left unread, then the label will the appear in bold with the number next of unread messages next to it, just like the Gmail "Folders" behave (e.g. Spam, Trash).
Of course you can choose more than one action, so you can star and archive a message at the same time.

## Advanced filters

The titles that Gmail gives each filter are in fact the "script" that it uses to parse each email. In other words, if you cut and pasted the entire title into the "Has the words" box, you would get the exact same filter. This obviously is silly--the interface generated that filter in a much easier fashion. But, it opens up new possibilities. For example, you now can do AND's and OR's to generate complex filters. So something like (subject:(biking)) AND (from:(foo) OR from:(bar)) would match all messages about biking that came from either foo or bar.
The symbol | (found on the same key as \), means OR. So you could write biking | helmet, which would be similar to (biking) OR (helmet), in the preceding paragraph.
Here are a few "super" filters.
* Create label bookmarks, in the to: box type in, youremail@gmail.com, and in the from: box, type in youremail@gmail.com, apply label bookmarks, archive now. Now, when you email yourself you won't clutter your inbox.
* Create label attachments. Check the Has attachments, label it attachments, archive it (if preferred). Now any email you have that has attachments, get labeled attachments. Making it easier to stay organized.
* Use Gmail as a multimedia holder. do the following: create filter, in the has words box, type filename:mp3, apply label music, check the latest updates
If you have another format and don't want to make a separate filter, do the following: filename:mp3 | filename:wav. Refer to 2nd paragraph (above) for what | means.
Google offers a range of documented and undocumented search and filter operators that can be used to fine-tune a filter.

## Weakness in filter pattern matching

One weakness is that Gmail filters on match on ASCII letters. In fact, only case-insensitive ASCII. So for example, I get a bunch of messages that nicely have a subject that starts with [Bike]. One would hope that matching on [Bike] in the subject line would grab these emails and nothing else. But, matching on [Bike] is exactly the same as matching on bike. So it matches, BIKE, Bike, bike, and obviously the intended [Bike].