Email spam filtering on mail.sas
This document offers a brief set of instructions for enabling general spam (junk email) filtering on mail.sas accounts, as well as customizing filtering techniques when the general spam filter fails.
Filtering techniques
General
General spam filtering is available to all mail.sas users. These filters "score" incoming messages for certain spam-like features. For example, any message that comes in that says "Get Rich Quick", or "Lose Weight Now" etc. will obtain a higher score than messages without such attributes.
Above a certain score, the message is automatically redirected to a caught-spam folder that is emptied once every three weeks (although you can empty it manually at any time with an IMAP client).
To enable this filter:
- Visit https://www.sas.upenn.edu/accounts
- Log in with your mail.sas username and password (not your PennKey username and password)
- Click once on Spam Filtering
- Adjust the filter strength to Strong and click on the Enable button to apply the change
If the filter is too strong — i.e. legitimate messages are not getting to your In box — then log in and adjust the filter strength. We still recommend the strongest setting as the general filter is well tuned at this point.
Custom
If mail.sas's spam filter is still not strong enough, and if there is other spam you receive frequently, which has specific, repetitive characteristics, then you can enable a custom filter.
This requires a greater degree of comfort with running command-line tools in a UNIX or DOS-like terminal environment, however. If you are not comfortable running command-line tools then I do not recommend following these instructions; just delete the spam message.
Otherwise, you will need to use any SSH-capable terminal application. In Mac OS X, this would be Terminal.app or Data Comet Secure 10. In Mac OS 9, you would use Data Comet Secure 5. In Windows, you would use SecureCRT. In Linux, use the command-line "ssh" tool through an Xterm session.
The commercial Mac and Windows terminal clients we distribute at Penn all have mail.sas connection profiles in them. Connect to mail.sas.upenn.edu with the preinstalled profile or "ssh mail.sas.upenn.edu" if you are using Terminal.app or Xterm. Log in with your mail.sas username and password.
If at this point you see a prompt that says [MAIN MENU], type "unix" (no quotes) and press Return. You should see a prompt similar to the following:
reynolda@sas(/home/r/reynolda)% Type in the following and press Return:
pico .procmailrc At this point, you will need to edit the following to the repetitive characteristic you would filter on. For example, if you want to filter spam that you receive from "badperson@annoying.com", type the following into your terminal:
SHELL=/bin/sh
MAILDIR=$HOME/Mail
LOG="---Log: ${LOGFILE} for ${LOGNAME}, "
:0:
* ^From.*badperson@annoying.com
caught-spamHere, the custom filter will redirect any message received with the "From" field containing "badperson@annoying.com" to the same caught-spam folder used for general-filtered spam.
To adjust to taste, you could replace the "From" text with any other header that contains the repetitive characteristic, e.g. "Subject", "Sender" or "Body". Likewise, you would replace the "*badperson..." text with the remaining repetitive spam feature. You can use wildcards, if appropriate.
Press and hold the Control button and the letter 'X' to save the text you've just entered. Type "exit" (no quotes) and press Return to leave the mail.sas terminal session.
Note: If you need to add any custom filters in the future, you only need to add a modified copy of what comes after the end of the "LOG=..." line in the .procmailrc file
