( Home )

( News )

( Download )

( Documentation )

( Development )

( Mission Stmt. )

( Reviews )

Mailfilter Example Configuration

Attention: This FAQ reflects changes only available in Mailfilter versions >= 0.7! In particular, the rcfile format has changed. See the man pages for details.

Creating a Config File:

Before you can execute the Mailfilter application you must create a file called


in your home directory, e.g. if your username was 'tux' then /home/tux/.mailfilterrc could be an appropriate place for it. In the .mailfilterrc file you must specify the POP accounts you want Mailfilter to check for spam. You also specify your filters, logfiles, maximum message size and other things.


Here's what a typical rcfile could look like. You can copy and paste this and then modify it to your own needs. For further information and a complete list of all supported keywords, please read the mailfilter(1), mailfilterrc(5) and mailfilterex(5) man pages. The following example is just to get you started as quick and convenient as possible.

# -----------------------------------------------------------
# Logile path (be sure you have write permission in this
# directory; you MUST specify a logfile).  This one auto-
# matically stores the log files sorted by month and year.

LOGFILE = "$HOME/logs/mailfilter-`date +"%h%y"'"

# -----------------------------------------------------------
# Level of verbosity
# 0  Silent, show nothing at all
# 1  Only show errors
# 2  Only show "Deleted..." messages and errors
# 3  Default; Show "Deleted..." messages, errors and
#    "Examining..." messages
# 4  Like (3), except this also shows the current
#    account's username
# 5  Like (4), except this also shows which filter
#    matched which string of an e-mail header
# 6  Debugging mode; prints out almost everything


# -----------------------------------------------------------
# POP server list (do not change the order of the fields!)
# Note: Port 110 is usually the port APOP/POP3 servers use.
# When SSL comes into play, then it is usually 995.

SERVER   = "pop.server.com"
USER     = "username"
PASS     = "password"
PROTOCOL = "pop3"
PORT     = 110

SERVER   = "pop.secondserver.com"
USER     = "anotherusername"
PASS     = "anotherpassword"
PROTOCOL = "pop3/ssl"
PORT     = 995

SERVER   = "apop.server.com"
USER     = "yetanoterusername"
PASS     = "yetanotherpassword"
PROTOCOL = "apop/ssl"
PORT     = 995

# -----------------------------------------------------------
# Do you want case sensitive e-mail filters? { yes | no }

REG_CASE = "no"

# -----------------------------------------------------------
# Sets the type of Regular Expression used { extended | basic }
# (The default is 'basic', don't change unless you know what
# you are doing. Extended REs are more complex to set up.)

REG_TYPE = "basic"

# -----------------------------------------------------------
# Maximum e-mail size in bytes that should not be exceeded.

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:.*Get penis enlargement"
DENY = "^Subject:.*WIN MONEY"

# This one filters mail from a certain person:
DENY = "^From:.*spammer@any_spam_organisation.com"

# This one filters mail from everyone at a certain
# organisation:
DENY = "^From:.*@any_provider_that_spams.org"

# 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.


# ----------------------------------------------------------
# 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:.*a_friend_with_account@any_provider_that_spams.org"

# 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:.*my_girlfriend@any_provider.com"

Generally the rcfile is not case-sensitive, which means it does not matter whether the keywords are spelled in capitals or not. You can place white space characters before and in between a command and its parameters. It is very important though to not mix up the order in which you specify your POP3 accounts: First comes 'SERVER', followed by 'USER', then 'PASS' and 'PROTOCOL' and finally 'PORT' which is usually 110, unless you know specifically otherwise.

Last updated on Mar 25, 2016 by Andreas Bauer.
Copyright © 2000-2016 Andreas Bauer. All rights reserved.
Valid HTML 4.0 Hosted by SourceForge