From LQWiki
Jump to navigation Jump to search

Procmail is a filtering program that processes your email, e.g. it can feed it to SpamAssassin or move it to the appropriate folders. It should be invoked automatically when mail arrives. Procmail can be configured via /etc/procmailrc.

Procmail statements fall in one of two categories:

  • assignments like LOGNAME=/var/log/procmail
  • rules for filtering

Test your procmail

To see if your procmail works, try the following:

echo "This will be in your mailbox" | procmail

Then look if the text is in your mailbox, e.g.:

cat /var/spool/mail/root

or if you use MailDirs to store your mails:

cat ~/Maildir/new/*

By this command, you should also be able to verify if your procmail calls SpamAssassin:

X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on
X-Spam-Level: ***
X-Spam-Status: No, score=3.2 required=5.0 tests=EMPTY_MESSAGE,MISSING_HEADERS,
This will be in your mailbox


The following can go into /etc/procmailrc


#Forward mail to spamassassin
| /usr/bin/spamc

#Move mail marked as spam to a Spam mailbox
* ^X-Spam-Level: \*\*\*

* ^X-Spam-Status: Yes

Moves all your spam to the .Trash folder must be a Maildir, procmail does not support /var/mail/USERNAME

Configure your procmail

Best, configure your procmail with webmin that has a module for doing that.

See also