Current spam filtering uses SpamAssassin to analyze an incoming mail message and determine whether it is spam. The heuristic tests used by SpamAssassin allow for fairly accurate diagnosis of incoming messages. Furthermore, the behaviour of SpamAssassin can be customized by the user.
Top of PageThe default system action on successful spam check is to append "SPAM:" to the beginning of the message subject line as well as to add "X-Spam-Flag: YES" to the message headers (which most of the e-mail viewers do not display until requested). The combination of the two makes spam easy to notice by the user as well as by a mail filtering program. A complete list of tests conducted on a message, message score and other SpamAssassin-related information is contained in the message headers (note that a user could remove this funtionality if he/she so desires).
Top of PageSpamAssassin is invoked through procmail before a new mail message is
supposed to go to user's mailbox. However, if a non-empty .forward file is
present in user's home directory neither procmail nor SpamAssassin will run.
To use SpamAssassin despite the presence of .forward, your home directory
must contain both .forward and .procmailrc with the following
contents:
-------------------------------- .procmailrc -----------------------------------
#use :0c to keep a copy of the message on the server
:0c
# OR use :0 to simply forward the message
#:0
#space separated list of addresses to forward to (list must start with!)
!user@server1.com user@server2.com
-------------------------------- .procmailrc -----------------------------------
--------------------------------- .forward -------------------------------------
#The following line must remain or spam filter will not work
"|procmail",
#UNFILTERED mail will be forwarded to the following addresses (comma-separated)
#(modify .procmailrc if you wish to forward FILTERED mail)
user@server3.com, user@server4.com
--------------------------------- .forward -------------------------------------
Both of the above files forward incoming messages. However, addresses
listed in .procmailrc will receive mail after it is scanned while
addresses in .forward file will receive untouched messages.
If addition of new preferences or modification of the defaults is desired, each user can store his/her own preferences in ${HOME}/.spamassassin/user_prefs. The most important of user options are required_hits (the higher the score, the less likely it is for mail to get tagged) and whitelist_from (a list of addresses which will NEVER be a source of spam - this option should be used for newsletters if they are incorrectly tagged).
Top of PageThere are at least three distinct ways in which a user can opt-out of spam
tagging:
1. Create a .forward file with the line /var/spool/mail/your_username or an
e-mail address where to receive mail (or both) and no "|procmail"
*NOTE: This will disable any user's existing procmail filters as well*
2. Add "all_spam_to your_username" to ${HOME}/.spamassassin/user_prefs
3. Notify the System Administrator so that the username could be added to the
all_spam_to line in global settings.
Mail filtering can also be done using procmail. The following is a
.procmailrc file that sends all potential spam to ~/mail/SPAM while forwarding
tagged mail to two other machines:
-------------------------------- .procmailrc -----------------------------------
#use :0c to keep a copy of the message on the server
:0c
# OR use :0 to simply forward the message
#:0
#space separated list of addresses to forward to (list must start with!)
!user@server1.com user@server2.com
# all potential spam is stored in ~/mail/SPAM
:0:
* ^X-Spam-Flag: YES
${HOME}/mail/SPAM
-------------------------------- .procmailrc -----------------------------------
To access ~/mail/SPAM from mail, simply use command folder ~/mail/SPAM.
In general, one could use procmail for all mail filtering and add spam folder to
the mail viewer.
If you wish to dump SPAM tagged messages automatically then add the following
to the beginning of your .procmailrc file:
-------------------------------- .procmailrc -----------------------------------
:0:
* ^X-Spam-Flag: YES
/dev/null
...... the rest of .procmailrc goes here....
-------------------------------- .procmailrc -----------------------------------
If your mail is currently forwarded from lepus to another machine using
an alias and you would like to have lepus scan your mail for spam, please contact
system administrators so that the alias could be disabled and appropriate
.forward and .procmailrc files created.
However, if your mail is currently forwarded using .forward file, please refer
to Running SpamAssassin.
If you are away and need to use the vacation program but you do not want to send
vacation replies to the spammers please modify .procmailrc as indicated below:
-------------------------------- .procmailrc -----------------------------------
#use :0c to keep a copy of the message on the server
:0c
# OR use :0 to simply forward the message
#:0
#space separated list of addresses to forward to (list must start with!)
!user@server1.com user@server2.com
# all potential spam is stored in ~/mail/SPAM
:0:
* ^X-Spam-Flag: YES
${HOME}/mail/SPAM
# vacation handles the remaining messages
# if you use aliases run vacation with -a flag and a list of aliases following it
# (see vacation manpage)
:0c
|/usr/bin/vacation $LOGNAME
-------------------------------- .procmailrc -----------------------------------
Please keep in mind that .vacation.db in your home directory has to be initialized with
vacation -I
before using vacation. Finally, appropriate .vacation.msg file needs to be created (please consult
vacation manpage for further details on this).
NOTE: If you accidently run vacation with no arguments vacation will create a
.forward file and move your old .forward to .forward.old. You will need to overwrite the new
file with .forward.old. In this situation vacation will also create .vacation.msg.