This page gives some simple hints on how to filter your email, and is intended for people who
use
Procmail. I used to store every incoming email
in
~/mail. Over time, that directory filled with megabytes of uninteresting and unread mail,
and deleting the ones I didn't want was a hassle. Sounds familiar? Read on.
First of all, many people fail to create proper Procmail-rules for identifying incoming mail. This especially applies
to subscription lists, where you get mail from many different users. The most important
tip I'll give you here is:
Don't match on the FROM and TO fields! In most cases, that doesn't work, and if
it does, you will most likely have to update the rule from time to time.
Instead of spending time on updating the Procmail rules, look for a line in the mailheader containing
List-Id: Some Name Here <some@emailaddress.here>
or
Mailing-List: Some Name Here <some@emailaddress.here>
If the list is decently managed, then all mail posted on the list
will contain such a line. Paste it in ~/.procmailrc as a matching rule:
:0:
*^List-Id: Some Name Here <some@emailaddress.here>
groupname/listname
This will store all mail on that list to the file
groupname/listname, relative to your mail directory.
I've adopted a very simple strategy for placing my email. Instead of dumping everything in
~/mail/ListName,
it's much cleaner to create subdirectories for some of the lists you use. For instance, I subscribe to some of the
SecurityFocus lists, so I put them in their own directory:
cd ~/mail
mkdir securityfocus
Then I update my
~/.procmailrc accordingly. This gives me a clean and manageable mail directory.
The last tip I want to give is to stow away mail that you don't really need in some temporary directory.
Spam
I use
SpamAssassin along with
Vipul's Razor to
filter out spam-mail. These are placed in
tmp/spam. The clue here is the directory,
tmp/. Couple
this with a cronjob like the one below, and you'll have an easier time reading mail. For instance, my crontab includes this line:
$ crontab -l
0 0 * * * find ~/mail/tmp -daystart -atime +3 | xargs rm -f
The above executes every midnight (
0 0 * * *), and will delete all temporary mailboxes in that haven't been read in the last three days (
-atime +3).
This is very useful when using SpamAssassin's spam level. Instead of blindly deleting everything that gets the spam-mark, potentially leading to losing mail from your Hotmail friends, you should thrash mail that is "almost definately spam". The rest can be stored in tmp/spam.
Mail from mailerdaemon
I never really read the mail from mailerdaemon either, unless I need to check if sent mail wasn't delivered. Therefore,
a rule in ~/.procmailrc along with the cronjob mention in the paragraph above will make sure I don't have to waste time
on it. I use the following ~/.procmailrc rule, and place it
at the bottom of the rc-file.
:0:
*^FROM_MAILER
tmp/maildaemon
The reason I place this rule at the bottom of procmailrc is that some people or lists will trigger the FROM_MAILER rule,
therefore I first file list mail under relevant list-mailboxes before checking for mail from the mailer daemon.
There are several tools for keeping track of all the incoming email you have received. I use a tool I've made
myself, called
Gubby. In brief, the screenshot
below should tell you everything
Gubby will do for you:
There are other tools available too, so check them out and install your favourite one.