Hi John! On Mi, 25 Jul 2012, John Long wrote:
> Guys, what are you using for killfiling/mail filtering?
>
> I am using Mutt's built in POP and SMTP at this point, is there any way to
> killfile emails based on header contents? Scoring won't be enough, I want to
> delete this crap as the email is being downloaded from my mail provider.
>
> I am not looking for bayesian or other high-falutin' anti spam measures. I
> want to create my own killfile like I do with my newsreader, basically just
> creating rules that match the idiots that spam the mailing lists I'm in.
I used to have a little shell-script, that was killfiling within mutt
for me (attached). It simply generates a pattern, that can be used by
mutt to delete messages by scoring.
Additionally, I needed to set up scoring for mutt like this:
#v+
~$ cat ~/.mutt/score
##################################################################
# Scoring Definitions for Mutt/Muttng
#
# Last update: Mi 2010-02-17 22:02
#
##################################################################
set score # enable Scoring
set score_threshold_delete=0 # delete messages with score 0
set score_threshold_flag=65 # auto-flag messages w/ score >= 35
set score_threshold_read=5 # mark messages w/ score <= 5 as read
# Remove all scorings
unscore *
# Default - Scoring
score '~N' +10 # new mails have a higher score than old mail
score '~A' +10 # all messages start with score 10
score '~g|~G' +2 # PGP signed / encrypted messages
score ~F +20 # flagged mails are important
score ~D =0 # this is a deleted email
score ~S =0 # superseded messages
score ~V +3 # cryptographic verified message
score '~x @256bit.org' +5 # Message references one of my message
# Subject dependent scoring
score '~s [Vv][Ii][Mm]' +10 # vim
score '~s [Mm][Uu][Tt][Tt]' +10 # mutt
score '~s [Ss][Hh][Ee][Ll][Ll]' +10 # shell
score '~s [Bb][Aa][Ss][Hh]' +10 # bash
score '~s [Zz][Ss][Hh]' +10 # zsh
# The good one ;)
score '~P' =20 # Message is from me
# SPAM
score '~f @aol.com' -2 # AOL is usually less important
score '~f webmaster@*' -2 # Webmasters kidnapped by evil cult :>
score '~s ^test$' -2 # all messages w/ subject "test" are killed
score '~s sex | ~s adult' -10 # STFU
score '~f anonymous' -10 # Yeah. Sure. Evil hackers from Serbia.
score '~=' -9999 # all duplicates are killed
score '~s ^unsubscribe$ !(~p|~P|~Q|~F)' -9999 # all msgs w/ subject
"unsubscribe" not by myself are killed
#score '!~f@' -10 # no mail address present?
score "~f '^([^ <>@]+ ){5,}'" -2 # a realname consisting of >=5 portions is
invalid, too
score "!~s .*" -2 # no Subject line
source ~/.mutt/score_gen
$~
#v-
That was basically it. It still works, although I don't use it anymore.
PS: No, procmail was no option, since I used sieve scripts to deliver my
mails.
regards,
Christian
mutt_score.sh
Description: Bourne shell script
