Jump to content

Gmail/Filters

From Wikibooks, open books for an open world

Filters can filtrate your incoming mails, and put them into labels, archive them automatically or delete them.

Create a filter

[edit | edit source]

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. Gmail-filters-actions.png

Advanced filters

[edit | edit source]

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.

  1. 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.
  2. 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.
  3. 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

[edit | edit source]

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].