Procmail

I prefer to use a specific e-mail address as my personal address for a number of reasons.

  1. I've had it for years and I don't want to have to update everyone with a new address
  2. The domain belongs to a good friend of mine and I don't have to worry about a specific ISP changing or a web-mail service changing.

That said, I prefer to read/write my mail with my gmail account. But, I'd still prefer to keep my mail in mbox format incase I ever want to stop using gmail.

Solution? Procmail

On my personal account's mail server, I have a procmail script setup that acts on every piece of incoming mail. First it moves any mail flaged as spam (by the server's local spamassasin rules) into a "spam" mbox, then it copies the message (if not spam) into an mbox named "year-month", then it forwards a copy to my gmail account.

Below is my procmail file (with e-mail addresses removed):

MONTH=`date +%Y-%m`	# example $MONTH = 2006-03

# ----- check for existance of this month's directory -----
:0 ic
* ? test ! -d $MONTH
| mkdir -p $MONTH && chmod 0700 $MONTH

:0:
* ^Subject: *\[SPAM
spam

:0c
! my_gmail_account@gmail.com

:0:
$MONTH