Cleaning up my mailboxes, and useful procmail-bits.
I started decluttering my e-mail. I thought over 1gb worth of e-mail took up too much space, and what the hell did I save in those folders anyway?
I found I also had a huge procmailrc that filtered through my messages and put them in many nested folders.
Before I started I made a small inventory of what I had:
- work-account, over 600MB in 4000 e-mails
- private account, over 400MB in 3000 e-mails
- third fun account, some 25MB worth of mail, nothing really important.
I use IMAP exclusively, and my accounts have about 1GB of space each, so I had the space to save it all. I also have the space to stack my living-room full of boxes, but I'd rather not.
So, I took the necessary steps to clean it up.
Step 1: Less folders!
I decided no more nested folders! This made everything a lot easier, and much cleaner, in mail.app and in mutt. Instant relief. Though I can't and won't go for that 'single archive' approach, I do prefer to have as little folders as possible. Right now I have the default 'Sent' (which I clear out daily) 'Trash' and 'Draft', and for my work account I have the folders 'work' 'social' 'specific mailing-list' 'other mailing-lists'. For my private account I have 'social', 'web', 'license-codes', 'health' and 'finance'. I do receive some social e-mail on my work-account (no rules against that where I work) so I decided to give that a special folder. I made a general and quick separation, based on gut-feeling alone. My work-account receives work-related mailing-lists, but all my other lists go to a third, specifically meant for mailing-list. This way I can disable the account, or simply not read it, if I just want to read my private e-mail.
Step 2: Clearing out old mail.
I went through all my e-mail.
Yes, all of it.
It was Hell.
It was horrible.
It was painful.
I have no clue why I saved so many e-mails that made me feel bad. I tossed them out.
I had e-mails from orders I made, years and years ago. Out they went.
Work related e-mails from problems long solved (talking years here). Delete delete delete.
E-mails with 10MB worth of photos attached. Saved the photos, deleted the attachment from the e-mail if I wanted to keep it, or deleted the e-mail entirely.
I deleted a lot.
I went from having over 1gb worth of e-mail (combined in all three accounts) to about 40mb (combined in all three accounts). I did it last week, and I still feel pretty damn good about it.
Step 3: Perfecting the archive process.
When e-mail from my family arrives, it gets tagged with a special header that MailTags understands. I did this by adding the following rule to my procmailrc:
:0f * ^FROM.*(adres1|adres2) | formail -A 'X-Keywords: family'
This tells procmail that if the mail comes from either 'adres1' or 'adres2' to add a header which says 'X-Keywords: family'. I have a similar rule for mails from friends.
I can then choose to filter it directly to my folder 'social' (for friends and family)
:0
* ^(X-Keywords|X-Mailtags).*(friends|family)
.social/
It opens up all kinds of useful tagging!
Then, I looked at my mailing-list mail. I didn't want the hassle of creating a new rule for every list I joined, or to have my procmailrc clog up with old rules, so I looked around and found a great solution:
` :0 * ^X-BeenThere: \/[^@]+ * ! ^(List-Id|X-(Mailing-)?List):.* .$MATCH/
0 * ^((List-Id|X-(Mailing-)?List):(.[< ]\/[^>])) { LISTID=$MATCH
:0
* LISTID ?? ^\/[^@\.]*
.$MATCH/
} `
Both these rules do the same thing, but they act on different headers. Not all mailing-lists use the same method, so I had to use more than one rule. Basically it either looks at the @X-BeenThere@ or @List-Id/X-Mailing-List/X-List@ to see what list the message comes from, and then filters it into a folder with the same name. Excellent!
Step 4: Enjoy!
After a week of using my freshly cleaned mail-accounts, I still feel great about it. Almost everything goes automatically, and I've only had to do minor tweaks so far. With the help of MailActOn I can easily file my e-mails and keep everything nice, clean, sorted and stick to Inbox Zero (which I've done for quite some time, but that archive of mail just kept on bugging me).
Aaaah, the joys of a clean mailbox!