Gmail's filters are a simple way to organize your messages automatically by providing a set of rules. Like most email clients, Gmail applies the rules to the messages you receive and to the sent mail.
Here are some of the most common Gmail filters:
1. Categorization filters
If you receive a lot of messages that need a distinctive category, create a filter that attaches them a label and archives them.
To separate your messages, you could share a different version of your email address that adds some information after the plus sign. So you could put this email address in your blog: email@example.com, instead of firstname.lastname@example.org. All the messages are sent to your address, but now you can create a filter that labels the messages sent to email@example.com.
2. Search filters
You can create filters for frequent queries. Just type in the "has the words" box your query (this list of Gmail operators should help):
has:attachment - messages that include attachments
filename:.mp3 - messages that include MP3 attachments
is:unread - collects all the messages you haven't read yet (or you marked as unread)
label:voicemail - the voicemail from Google Talk
3. Separate your identities
If you forward messages from other mail accounts or use Gmail's mail fetcher, create filters that attach labels to these messages. Just enter the appropriate mail address in the To field when you create each filter.
Newsletters save you time and bring (sometimes) useful information, but they also clutter your inbox. If you receive daily newsletters, create filters that label the messages and archive them, so they don't stand in your way.
If you don't want to read messages from a bunch of people, create a filter that sends to trash each and every message received from them. Just enter their email addresses separated by OR in the From field. I made a small script that makes it easy to build a blacklist.
Gmail's spam filters are pretty good for most people, but that doesn't mean you won't see false positives. If most of the spam mail that reaches your inbox has some easy to identify traits (for example, it contains "lottery"), create a filter that sends these messages to the trash. Because you won't mark these messages as spam, you won't be improving Gmail's spam filters. Also you may lose some genuine messages if you don't build your filter carefully.
7. No more spam counters
If you don't like to see how many unread spam messages you have, create a filter that marks as read all your spam.
Type in "Has the words": is:spam
Check Mark as read
Click OK to Gmail's warning
You should check the messages marked as spam from time to time because you may lose important messages incorrectly classified by Gmail.
8. Backup filters
Create a filter that forwards some of your messages to another account. You could send all the messages that include attachments, so you could easily delete them when you reach Gmail's storage limit.
This Greasemonkey script (that requires Greasemonkey and Firefox) lets you create filters from each message by filling the email address of the sender and the destination address.
Also when you create a new filter, Gmail provides an option to apply the rules to the existent messages (you can't forward existent messages using filters, though).