the evans center for sleep deprivation studies
« prev | current | next »
nov 25 2002 10:39am
eating nasty chinese food at the L&L in hawaii.
eating nasty chinese food at the L&L in hawaii.

gse vs. procmail.

Hi. GEEK TIME. Enjoy.

I've done two good email things lately. (1) start using SpamAssassin. That's good shit. (2) start archiving every piece of email I receive. I don't know why I didn't do that a long time ago.

Actually, good archiving rules aren't as simple as they might seem (of course). Maybe that's why it took me so long to figure out a solution.

  • I don't want to archive spam, voluminous mailing list traffic, or messages with huge attachments. (edit oct 2006: disk is cheap. I decided that I might as well archive huge emails too, so I've nuked that part of my .procmailrc.)
  • One giant all-encompassing archive isn't good for searching. I want archives split up by month.
  • I do 99% of my email with pine. Pine will FCC all your mail to a folder, but you can't set the folder dynamically by month.
So, here's my solution. It involves procmail and a small cron script.

Folder stuff

  • Everything goes in ~/mail/archive/YYYY-mm.
  • Pine is set to FCC everything to ~/mail/archive/current. This file is actually a softlink to the appropriate YYYY-mm file.
  • Using cron, I run a script at the beginning of every month that updates this softlink.
Procmail stuff
  • Filter out any known viruses -- for a while I was getting a lot of klez-infected mail.
  • Put mailing lists in ~/mail/lists.
  • Send all remaining mail through SpamAssassin. Route messages tagged as spam into ~/mail/caughtspam.
  • Archive everything that's left into the archive folder, and let a copy of these messages get delivered normally.

Here's the appropriate files:
  the crontab entry
  the script called by crontab
  my .procmailrc

It's pretty simple and once its set up, it just works. My next goal is to make the archives more searchable (grep doesn't cut it). My new theory: everything everywhere should be a database. More on that later.

I imagine 99.8% of the email users out there will never ever have any use for this stuff. But hey, fuck 'em if they can't take a joke. I spent enough time on this that I figured someone else might be able to use it. Let me know if you do, especially if you improve it.