procmail
[Top] [All Lists]

spam filtering

2001-11-12 06:03:26
Hi there,

I got so tired of all the nonsense replies to spam on mailinglist, that
I decided to write some rules to filter them out. It would be nice to
hear what you people think. Any tip or advice appreciated :)

From what I can see, they work quite nice. 

# add spammers to list of known spammers and/or plonk thread
:0:
* ^To(_dot_)*stigbrau(_at_)start\(_dot_)no
* ^From(_dot_)*stig(_at_)brautaset\(_dot_)org
{
        # add addresses from the subject line to the list of known spammers
        :0
        * ^Subject.*spammer[    ]*\/[^  ].+
        | echo $MATCH >> ~/Mail/SPAMMERS
        
        # just plonk the thread, not all mails from the person.
        :0
        * ^Subject.*plonk[      ]*\/[^  ].+
        | formail +1 -ds | formail -x"Message-Id:" >> ~/Mail/SPAM_THREADS
        
        # If I forward spam to myself, sender of the original mail should be
        # blacklisted
        :0
        | formail +1 -ds | formail -x"From:" -x"Sender:" -x"X-Envelope-Sender:" 
| sed 's:^.*<\(.*\)>$:\1:' >> ~/Mail/SPAMMERS
}

:0:
* ? formail -x"From" -x"From:" -x"Sender:" -x"X-Envelope-Sender:" | fgrep -is 
-f ~/Mail/SPAMMERS
{
        :0 hwc
        | formail -cx"Message-Id:" >> ~/Mail/SPAM_THREADS
        :0 ahwc
        | formail -cx"Subject:" | sed -e s/^\ */\"/ -e s/$/\"/ >> 
~/Mail/SPAM_SUBJECTS
        :0 a
        spam
}

## some mailers don't set a proper references or in-reply-to header, so
## we can't catch them. I was hoping to catch them by subject, but no
## luck yet.
#:0:
#* ? formail -cx"Subject:" | fgrep -sf ~/Mail/SPAM_SUBJECTS
#{
#       :0 hwc
#       | formail -cx"Message-Id:" >> ~/Mail/SPAM_THREADS
#       
#       :0 a
#       spam
#}


:0:
* ? formail -cx"References:" -x"In-Reply-To:" | fgrep -is -f ~/Mail/SPAM_THREADS
{
        :0 hwc
        | formail -cx"Message-Id:" >> ~/Mail/SPAM_THREADS
        :0 a
        spam
}

Regards,
Stig

-- 
brautaset.org
Registered Linux User 107343
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • spam filtering, Stig Brautaset <=