OK, this is not another post on how to use Mutt and Gmail. This is just to comment on a feature I found in Mutt that was not obvious, and that helped me to stop running my own anti-spam tool.
So, for a number of reasons, my company stop filtering spams. I was setting up dspam to take over that job when I decided that it was just too much pain for a single account. Besides, although I am spammed a lot, I would never possibly be more efficient than Gmail anti-spam, given the load of emails their users classify everyday.
I am not migrating my old emails over to Gmail, though. And I am pretty comfortable with my current email work-flow… I am simply not going to use a webmail (even one as powerful as Gmail). OK, I am using GNOME 3 after being a Fluxbox and Bluetile user, but everything has a limit…
But how to keep the best of both worlds? And, more important, how to do that with minimum disruption of what I already have (my own IMAP server and Mutt managing my account there as spoolfile)? The answer is a little known trick using the “mailboxes” directive in .muttrc.
This directive accepts a fully-qualified imap mailbox address. So I just added something like:
and added some shortcuts to save email from my inbox to that mailbox (the same as train-as-spam) and to rescue email from it (the same as train-as-ham):
macro index <F3> ";Wo;Wn;simaps://gmail-user:firstname.lastname@example.org:993/[Gmail]/Spam\n" "Train as SPAM" macro index <F4> ";Wo;Wn;simaps://gmail-user:email@example.com:993/INBOX\n" "Train as HAM"
and that was it. In my IMAP machine I got a fetchmail downloading emails from Gmail’s INBOX so I can get trained-as-ham and new emails (all emails arrive first in my Gmail account) into my IMAP server. All my sieve rules are in place and nothing changed in my email work-flow.
It’s been working flawlessly for a week now. The only drawbacks are (1) Gmail knowing everything that arrives to me (not a big deal, since unencrypted emails aren’t private anyway),
and (2) not getting the spam-count once Mutt is run: I have to change into that mailbox to log-in to Gmail.
Update: Mar 30, 2012 @ 18:15: I just found out that drawback number (2) above can be fixed by adding the following to .muttrc: