Sometimes I get funny looks from people when they see me check my mail with mutt. In this day of graphical mail clients that create pretty HTML email, I must look like a caveman with my text-based client. Still, I haven’t found a GUI email client that will let me have the level of configurability I have with mutt such as the ability to tie specific sigs (and whether to top or bottom post the sig) based on to whom I’m sending an email or the email folder I’m in. Plus mutt is fast. I like to joke that I can open mutt, check mail, and close it before another mail client loads.
A lot of the GUI email clients have started adding features to help us deal with the deluge of spam that everyone seems to get from time to time. Recently Mozilla Mail/Thunderbird added a “Junk” button that lets you mark mail as junk so that it can learn from that to tag new messages. I realized that similiar functionality for me was only a few muttrc tweaks away.
First I needed to identify potential spam. I’ve been getting a lot of “borderline” spam myself lately. By borderline I mean spam that doesn’t quite meet my spam threshold so it makes it through. Most of the time these messages have vague-enough Subject lines that I end up opening them to make sure before I get rid of them. If I knew that these were borderline messages I could get rid of them without having to open them, so if your spamassassin threshold was 5 (the default) you might set up a rule like this:
color index red default '~h "X-Spam-Status:.*score=(2|3)."' color index brightred default '~h "X-Spam-Status:.*score=(4|5)."' color index magenta default '~h "X-Spam-Status:.*score=(6|7)."'
These are just examples but you can see how they might work. Messages with a spam score of 2 or 3 are colored red, 4 or 5 are colored bright red, and 6, or 7 are colored magenta. That last line I use when I’m in the spam folder so I can more easily find potential false positives.
Once I identify a message as spam, I want to move it to a spam folder I maintain on the mailserver. I have a cron job set up to train spamassassin on that folder every day, so I want it to learn from messages that got through. While I could type ’s’ to tell mutt to save the message, and then type in the path to my spam folder, I’m lazy, so I set up a macro:
macro index S "simaps://mail.example.com/INBOX.spam" macro pager S "simaps://mail.example.com/INBOX.spam"
Now I just hit ‘S’ and it automatically saves the message in the spam folder. Granted these commands are not too advanced, but that’s part of the point I suppose–you can get a lot of the same functionality from fancier email clients with just a few tweaks to a .muttrc file.
What tweaks have you made to mutt to make it easier to manage spam?