Promail Filtering

Procmail Filtering - Stop unwanted spam and viruses

As email arrives for a user, it is passed onto the user's ~/.procmailrc file (if it exists). You can process/filter your email with "procmail recipes". "man procmailex" on unix machine for many examples. procmail.org has wonderful links, including http://pm-doc.sourceforge.net/pm-tips.html.

SpamAssassin

Benefits of procmail

  • Automatically sort email based on subject, sender, recipient
  • filter spam
  • Train SpamAssassin to detect spam
  • optionally deliver your email directly to a folder in your home directory so you no longer have to deal with "Mailbox too large" warnings.

Sample ~/.procmailrc file

------- cut here --------------
PATH=/bin:/usr/bin:/usr/bin
MAILDIR=$HOME     #you'd better make sure it exists
#DEFAULT=$MAILDIR/MailBox     #completely optional
LOGFILE=$MAILDIR/from     #recommended
#VERBOSE=yes     #added logging
SPAMASSASSIN=spamassassin

# delete any email with Flame in the subject (send it /dev/null)
:0
* ^Subject:.*Flame
/dev/null

# filter email with spamassassin, tagging spam with an extra header
# Option added to not check files with large attachments. Those are
# rarely spam and can be too much of a load on our mail server.
:0fw
* < 256000
| $SPAMASSASSIN -L

# if spamassassin labels email as spam, then filter it (move to Mail/junk)
:0:
* ^X-Spam-Status: Yes
Mail/junk

#otherwise, go to your mailbox
-------- to here ----------------

A more advanced promail file can be found here.

Also learn how to train spam assassin here.

What does SpamAssassin do?

Procmail will filter email through spamassassin. Spamassassin works on a threshold point system. Certain spam characteristics are awarded a point number. If the point values exceeds a threshold, spamassassin will insert an X-Spam-Status: Yes in the headers. You then have procmail filter those to a spam folder or /dev/null Spamassassin also creates a ~/.spamassassin directory where you can define other configuration options.

 
Link To CSE Sourses Link To CSE Student Home Pages Link To CSE Facilities Link To CSE Help Page Link To CSE Calendar


3115 Engineering Building
East Lansing, MI 48824-1226
Phone: (517) 353-3148
Fax: (517) 432-1061
web@cse.msu.edu