[olug] mailfilter

Vincent vraffensberger at home.com
Sat Jun 16 05:28:41 UTC 2001


Since filtering has been mentioned lately, I thought I'd mention mailfilter.
This is a very simple program which will connect to your (multiple) pop3
mail servers and delete messages for you based on the header info.  It uses
regexp and also have some features for various log levels and an always
allow function.  I've used procmail before, but this takes five minutes to
setup and accomplishes everything I need.  Just add it as a cron job and
forget about it.  Here are the links:

http://linuxgazette.com/issue67/arndt.html
http://mailfilter.sourceforge.net/

Here's a sample of my .mailfilterrc file to demonstrate how simple it is:

LOGFILE=/var/log/mailfilter.log
# -----------------------------------------------------------
# Level of verbosity: 0-6
VERBOSE=3
# -----------------------------------------------------------
POP3 server list (do not change the order of the fields!)
SERVER=pop.secondserver.com
USER=anotherusername
PASS=anotherusername
PROTOCOL=pop3
PORT=110
REG_CASE=no
REG_TYPE=basic
MAXSIZE_DENY=1000000
# Filter rules for detecting spam (each rule must be placed in a seperate
line)
# These filters detect certain unpleasant e-mail subjects:
DENY=^Subject:.*Credit*
DENY=^Subject:.*loan*
DENY=^Subject:.*digest*
DENY=^Subject:.*viagra*
DENY=^Subject:.*herbal*
DENY=^Subject:.*seed*
DENY=^Subject:.*weight fast*
DENY=^Subject:.*free money*
DENY=^Subject:.*make money*
DENY=^Subject:.*money*home*
DENY=^Subject:.*debt*
# This one filters mail from a certain person:
DENY=^From:.*spammer at any_spam_organisation.com
# This one filters mail from everyone at a certain organization:
DENY=^From:.*@*.it
DENY=^From:.*@*.jp
DENY=^From:.*@*.kr
DENY=^From:.*@*.dk
# We don't want any of those 'LEGAL' messages either
# while stuff with 'legal' in the subject still interests us:
DENY_CASE=^Subject:.*LEGAL
# -----------------------------------------------------------
# Normalises the subject strings before parsing, e.g.
# ',L.E-G,A.L; ,C.A-B`L`E, +.B-O`X` ;D`E`S,C;R,A.MB;L,E.R-]'
# becomes 'LEGAL CABLE BOX DESCRAMBLER' which can be filtered.
NORMAL=yes
# -----------------------------------------------------------
# The maximum e-mail size in bytes that messages from friends
# should not exceed. Set this to 0 if all your friends (ALLOW)
# can send messages as long as they want.
MAXSIZE_ALLOW=0
# ----------------------------------------------------------
# Set list of friends that always pass, if they do not
# exceed the message length of MAXSIZE_ALLOW
# This rule allows all mail from a friend who was unlucky enough
# to have signed up with a spam organisation. With DENY we
# block everyone else from that domain though! See above!
ALLOW=^From:.*@dtn.com
# Of course we allow e-mail from anyone who has something to say about
# mailfilter:
#ALLOW=^Subject:.*mailfilter
# We also let our girlfriend send any e-mail she wants:
ALLOW=^From:.*@conagra*.com


---------------------------------------------------------------------
To unsubscribe, e-mail: olug-unsubscribe at bstc.net
For additional commands, e-mail: olug-help at bstc.net



More information about the OLUG mailing list