St. Louis Unix Users Group St. Louis UNIX Users Group   Your forum for exchanging information about open standards,
open systems, open source, products, services and architectures
  Mail Filtering Using Procmail

This page has not been updated for the 2008 change from AIX to Debian. While all the procmail configuration information is still accurate, it is not sure if procmail will work at all, since the change to having mail and user home directories being on separate systems.

To use procmail on your SLUUG account to filter mail as it is delivered to your system mailbox in /var/spool/mail/:

  • Procmail is now the Mail Delivery Agent (MDA) for SLUUG, so you don't have to monkey with .forward to have it call procmail.
  • You don't have to do this, no action is needed. If you do nothing, mail will be delivered the same as before.
  • Create a .procmailrc in your mailbox. It must have permissions set to prevent writing by group or other.
  • Test it by sending yourself mail.

If you do use procmail, there are many options:

  • You can completely throw away probably spam, or almost certain spam.
  • You can store various levels of spam scores in different mailboxes in your home directory.
  • You can store non-spam in your system mailbox in /var/spool/mail/.
  • You can store mail in different mailbox formats to match your mail client, such as Berkeley mbox, MH, Maildir, etc.
  • For help in creating procmail recipes, see:
    • Man pages procmail, procmailex, procmailrc, and procmailsc.
    • The procmail FAQ: http://www.iki.fi/era/procmail/mini-faq.html www.iki.fi/era/procmail/mini-faq.html
    • The Procmail Quick Start: http://www.ii.com/internet/robots/procmail/qs/ www.ii.com/internet/robots/procmail/qs/
  • If you are just forwarding mail and not filtering, use .forward, not .procmailrc.

These examples using procmail are just that, examples. They are more complicted than most people would want, showing several options including sending mail to a file and being left in the UNIX inbox. You probably have filtering criteria in your mail client that that fit your needs, such as dividing mail into different "folders", deleting mail, or placing a special mark on the inbox listing based on the spam headers and the spam scores that fit your needs.

  • stars.procmailrc.txt uses the "stars" version of the SpamAssassin score on the X-SLUUG-MailScanner-SpamScore: header to send spam to /dev/null or a file in the user's home directory and non-spam to the normal UNIX inbox. This is probably closest to what would fit many people's needs and using the stars, or the flag, is probably supported the most clients.
  • flag.procmailrc.txt uses the "spam" or "not spam" flag, set by the system scoring threshold, to send spam to one file in the user's home directory, non-spam to another file, and unchecked mail to a third file.
  • score.procmailrc.txt uses the numeric version of the SpamAssassin score on the X-SLUUG-MailScanner-SpamCheck: header to send spam to one of two files in the user's home directory, non-spam to a third file, and mail without the header to a fourth file. Picking out and checking the number is more complicated than other methods.
 
  Home | About Us | Resources | Members | Volunteer | Other Groups | Sponsors | Contacts 
Copyright ©  St. Louis UNIX Users Group  2003-2004 | webmaster@sluug.org