Inklings: a tumblelog

Fixing my mail

Ever since I moved over to using mutt as my primary mail reader, I’ve been attempting to manage my mail in a rather simplistic, if surprisingly effective manner: one big inbox.

This worked well enough, but I’ve began to find myself overwhelmed by the mailing lists I’m on and some of the various sundry rubbish I get in my mail, so I’ve came to the decision that I’m going to have to reintroduce some kind of filtering again.

My new way of managing mail is simple: there’s three mailboxes: one of lists, one for sundry rubbish (invoices, &c.), and everything else goes into my primary inbox. Then, at the end of every month, everything in those mailboxes gets archived if it’s over thirty-one days old.

Below is my initial fdm ruleset. I’ve purposely omitted a few things, the mailing list rules could do with improving, and haven’t written the junk mail filtering rules, but it’s pretty close to complete:

path = "%h/Mail"

action "keep" keep
action "drop" drop

# Basic folders.
action "inbox"     maildir "${path}/inbox"
action "junk"      mbox    "${path}/junk"
action "family"    maildir "${path}/family"
action "friends"   maildir "${path}/friends"
action "sundry"    maildir "${path}/sundry"
action "reference" maildir "${path}/reference"
action "lists"     maildir "${path}/lists"

# Housekeeping
action "archive" mbox "${path}/archive/%[maildir]-%yq%Q" compress

account "stdin" disabled stdin

account "local" mbox "/var/mail/keith"

account "archive" disabled maildirs {
    "${path}/inbox"
    "${path}/sundry"
    "${path}/lists"
}   
match account "archive" and age > 31 days action "archive"
match account "archive" action "keep"

action "crap" remove-headers { "X-*" "*-Signature" "Received-SPF" }
match all action "crap" continue

# List filtering
match "^Precedence:[ \t](bulk|list)" in headers
   or "^Sender:.*metacl-bounces@conlang.org" in headers
   or "^Sender:.*kragen-tol-bounces@canonical.org" in headers
   or "^(Sender|Reply-To|Mailing-list):.*(langsmiths|celticonlang|concatenative|conculture|rest-discuss|testdrivendevelopment)@yahoogroups.com" in headers
   or "^(Sender|Reply-To|Mailing-list):.*(gevent|listyland|ossdev-ireland|python-ireland)@googlegroups.com" in headers
   or "^(Sender|Reply-To):.*CONLANG@listserv.brown.edu" in headers
   or "^(Sender|Reply-To):.*ilug-bounces@linux.ie" in headers
   or "^(Sender|Reply-To):.*ilug@linux.ie" in headers 
   or "^(Sender|Reply-To):.*open@webnet.ie" in headers
   or "^Sender:.*phpug-bounces@lists.iephpug.org" in headers
   or "^Sender:.*pycrypto-bounces@lists.dlitz.net" in headers
   or "^Reply-To:.*pycrypto@lists.dlitz.net" in headers
   or "^Sender:.*ubuntu-ie-bounces@lists.ubuntu.com" in headers
   action "lists"

# Crap I get sent that doesn't matter much
match "^From:.*billing@digiweb.ie" in headers action "sundry"

match all action "inbox"

I bet when I review my cleaned up inbox, I’m going to find a pile of mail I’d miss due to mailing list detritus. sigh…

Update

A wee bit of tweaking later, and here’s what I’m currently using. I’ve scrapped a couple of folders (family and friends), my eircom.net and GMail accounts are now being pulled in (with login details safely ensconced in my .netrc file), and since all the mail was delivered from /var/mail/keith the first time I ran the original, I was able to scrap that account and now Postfix is running fdm on delivery, which is precisely what I’d wanted in the first place.

path = "%h/Mail"

account "eircom.net" pop3 server "mail.eircom.net" no-apop
account "gmail" pop3s server "pop.gmail.com" port 995
account "stdin" disabled stdin

action "keep" keep
action "drop" drop

# Basic folders.
action "inbox"     maildir "${path}/inbox"
action "junk"      mbox    "${path}/junk"
action "sundry"    maildir "${path}/sundry"
action "reference" maildir "${path}/reference"
action "lists"     maildir "${path}/lists"

# Housekeeping
action "archive" mbox "${path}/archive/%[maildir]-%y-%m" compress

account "archive" disabled maildirs {
    "${path}/inbox"
    "${path}/sundry"
    "${path}/lists"
}
match account "archive" and age > 31 days action "archive"
match account "archive" action "keep"

action "crap" remove-headers { "X-*" "*-Signature" "Received-SPF" }
match all action "crap" continue

# List filtering
match "^Precedence:[ \t](bulk|list)" in headers
   or "^Sender:.*metacl-bounces@conlang.org" in headers
   or "^Sender:.*kragen-tol-bounces@canonical.org" in headers
   or "^(Sender|Reply-To|Mailing-list):.*(langsmiths|celticonlang|concatenative|conculture|rest-discuss|testdrivendevelopment)@yahoogroups.com" in headers
   or "^(Sender|Reply-To|Mailing-list):.*(gevent|listyland|ossdev-ireland|python-ireland)@googlegroups.com" in headers
   or "^(Sender|Reply-To):.*CONLANG@listserv.brown.edu" in headers
   or "^(Sender|Reply-To):.*ilug-bounces@linux.ie" in headers
   or "^(Sender|Reply-To):.*ilug@linux.ie" in headers 
   or "^(Sender|Reply-To):.*open@webnet.ie" in headers
   or "^Sender:.*phpug-bounces@lists.iephpug.org" in headers
   or "^Sender:.*pycrypto-bounces@lists.dlitz.net" in headers
   or "^Reply-To:.*pycrypto@lists.dlitz.net" in headers
   or "^Sender:.*ubuntu-ie-bounces@lists.ubuntu.com" in headers
   action "lists"

match all action "inbox"

I just have to wait until tomorrow, which is when fdm is scheduled to archive all the old emails I’ve pulled in from GMail. The biggest revelation from implementing all this is exactly how much non-list mail I’ve missed because everything’s been scattered all over the place. Consolidation is proving to be a very good thing.