Using procmail for spam filtering
The IT-section at NTNU, ITEA (the link only exists in Norwegian), has implemented a system on the e-mail servers to check all incoming e-mail to determine how probable it is that it is spam. This article shows you how to use procmail to filter out messages that has been tagged by the spam filtering system.
Setup
- Connect to your home directory
- Download the finished .procmailrc file and save it on M:
- Log on to login.stud.ntnu.no and run the command mv procmailrc.txt .procmailrc (remember the dot). You cannot change this in Windows Explorer
- Check your spam folder once in a while to delete spam (thus freeing some space) and to find legitimate e-mail which has been filtered wrongly
A warning when using procmail: If .procmailrc contains syntax errors e-mail will still be delivered, but it can be hard to predict where the e-mail will be delivered. To check whether your filtering rules work correctly, you may download an e-mail to your home area, execute the command cat e-mail.txt | procmail there, and check if it was delivered correctly. To check effectively you should edit e-mail.txt so that it is caught by the last rule you added.
procmail looks for filtering rules in the file .procmailrc in your home area to determine where e-mails should be delivered. The file could for example look like this:
MAILDIR=$HOME/mail LOGFILE=$MAILDIR/.procmail-log DEFAULT=$MAILDIR/INBOX # Checking the spam headers :0 H: * ^X-Spam-level: \*\*\*\*\* spam
- MAILDIR is the main directory for e-mails
- LOGFILE is the file which procmail logs to
- DEFAULT defines which folder the email should be put in if none of the rules in the file apply to it
- # starts a comment line
- :0 H: means that a rule is starting, and the "H" means that procmail should only check the header for matches
- * is the start of a rule line
- ^X-Spam-level: \*\*\*\*\* matches a line starting with the text "X-Spam-level: " followed by five asterisks ("*"). To filter out more spam you may decrease the number of occurences of \*, and to lower the amount of wanted e-mails that are filtered as spam you may increase it.
- The last line defines which folder the e-mail should be delivered to if it matches the rule.
| Språk: | Kommentarer: | 0 | Aid: | 250 | Brukervurdering: |
|
|
| Sist oppdatert: | 2007-06-25 | Forfatter: | skolmli | Lest: | 2889 ganger |