You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

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:

: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. This rule will use a lock file `spamassassin.lock', this is a good idea to do if there will be more then one instances of SpamAssassin working on a message. 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.

Jacobson made a http://jidanni.org/comp/spam/spamdealer.html big deal about this. Bye

  • No labels