Procmail System Rules

System Procmail Rules

Procmail is used as the local mail delivery agent and also to invoke SpamAssassin to tag suspected spam. Because it is the default local delivery agent, a .forward is not required to invoke procmail rules. For those of you who are already familiar with procmail, here are the system-wide rules:

     DROPPRIVS=yes
MAILDIR=$HOME/mail
INCLUDERC=/etc/mail/spamassassin/spamassassin-default.rc
:0:
* ? test ! -f $HOME/.procmailrc
* ^X-Spam-Status: Yes
spam

The first rule causes procmail to execute with the recipients permissions for security reasons and also to ensure that spamassassin reads your user preferences and creates files with your ownership so you can edit them.

The next rule tells procmail that your mail folders are located in a subdirectory called “mail” in your home directory. Then procmail calls spam assassin to evaluate mail as spam or non-spam and add an X-Spam-Status: line with a Yes/No result.

Next, we check to see if you have your own “.procmailrc” file. If you do not, we place any mail tagged as spam in your “spam” mail folder. If you do have your own “.procmailrc” file, then we only tag the spam and leave it up to your rules to determine what to do with it.

Simple Examples

If you want to send all e-mail that is scored as spam by spamassassin to your spam folder, the following rule would do it. This is also the default behavior if you have no .procmailrc at all.

     :0:
* ^X-Spam-Status: Yes
spam

If you are extremely trusting and just want to discard all e-mail that spamassassin determines to be spam, the following rule would do that.

     :0:
* ^X-Spam-Status: Yes
/dev/null

On Linux and other Unix-like operating systems, /dev/null is a data sink. That is any data sent to it is discarded.

Recent Posts