Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: missing edit-log entry for this revision

How do I use SpamAssassin with procmail?

Edit or create a .procmailrc file in your home directory containing the below lines. If you already have a .procmailrc file, add the lines to the your .procmailrc file:

No Format

:0fw:spamassassin.lock
| spamassassin

:0e
{
  EXITCODE=$?
}

:0:
* ^X-Spam-Flag: Yes
caughtspam

The first stanza filters all incoming mail through SpamAssassin and tags probable spam with a unique header. The next stanza protects against errors. If spamassassin returns an error it is passed back to the mail transfer agent and improves robustness of mail delivery.

Most people prefer to have spam blocked and saved to a file in your mail directory. The next stanza instructs procmail to save any tagged messages to a "caughtspam" folder in your procmail MAILDIR directory.

For a more complicated example see the procmailrc.example file in the distribution:

http://spamassassin.org/dist/procmailrc.example

The spamc client program can be used instead of spamassassin, if you intend to install and use the spamd server system-wide.

Read 'man procmailrc' and 'man procmailex' for futher details and explanation.