Configuring Procmail and .forward
Your .forward
and .procmailrc
files live on the mail server, specifically
in /mnt/mail.cs.brandeis.edu/username
, which is accessible from any public
workstation.
To forward your mail elsewhere, create
/mnt/mail.cs.brandeis.edu/username/.forward
containing your desired
destination, eg:
# Forwards all mail to username@example.com
username@example.com
# or...
# Keep a local copy, forward a copy to username@example.com
\username,username@example.com
To use procmail, create /mnt/mail.cs.brandeis.edu/username/.forward
containing:
|procmail
An example .procmailrc
is shown below:
# Log everything.
LOGFILE=procmail.log
# Eliminate multiple copies of a message cc'd to multiple lists of which
# I am a member.
:0 Wh: .msgid.cache.lock
| formail -D 8192 .msgid.cache
# Mail addressed explicitly to me goes to INBOX.
#
# Replace <FIRSTNAME> with your first name
# Replace <LASTNAME> with your last name
# "|" means "or", so this expression checks for mail addressed to your
# first name OR your last name.
:0
* ^TO.*(<FIRSTNAME>|<LASTNAME>)
{
:0
${DEFAULT}
}
# Everything else goes to a "possibly-spam" folder.
:0
possibly-spam
Dealing with spam using procmail
All mail coming into the mail server is scanned for viruses using ClamAV, and passed through SpamAssasin. ClamAV automatically quarantines email containing malicious payloads (if you have a legitimate need to share such material with colleagues for research purposes, please ask for advice on how to exchange such files safely), and SpamAssasin performs the following actions:
All messages are scanned, and assigned a score. Messages with scores over 5 are considered spam. Messages with scores below 5 are not considered spam. All messages start out with a score of 0. It is possible for a score to be less than 0. All messages, regardless of status, are marked with the following headers:
X-Spam-Status
: ‘Yes’ or ‘No’, followed by score, and the breakdown of the tests that contributed to the scoreX-Spam-Score
: The spam’s numerical score.X-Spam-Level
: One asterisk (*
) for each point above 0 (eg:**
for mail scored at 2.95)
If a message scores at or above 5, it is considered to be spam, and the following actions are taken:
- The subject line is prepended by the string
*** SUSPECTED SPAM ***
to aid in visual identification. - The header
X-Spam-Flag: YES
is added to the email.
This is the only action taken on messages believed to be spam. This decision was made after a survey of the department indicated that people feared false positives and wanted the greatest amount of control over their own email filtering.
The easiest method to keep spam out of your inbox is to insert the following
procmail rule into your .procmailrc
(after properly configuring your
.forward
). This rule can be used by itself, or as a part of a larger procmail
recipe:
# If you don't already have the following line, add it:
LOGFILE=.procmail.log
# Redirect all mail flagged as spam by SpamAssasin to a suspected-spam folder:
:0
* X-Spam-Flag: YES
suspected-spam
The above rule will place all email tagged as spam by SpamAssasin in a
“suspected-spam” folder. Advanced users may tweak this rule to filter based
on score, or make other delivery decisions. Please note that if you send your
mail to /dev/null
we can not recover it for you.