How do I ensure that procmail is working?
If you already use procmail, skip to the next section. If not, ensure procmail is installed using {{ Wiki Markup which
procmail
}} or install it from \[http://www.procmail.org/ www.procmail.org\]. Note that some systems use procmail by default, so the directions in the next paragraph may not be necessary for your installation. Also, some accounts require use of web-based configuration tools to specify that a given mailbox should "filter" to {{/usr/bin/procmail
}} (for example).
In a traditional shell installation, create a .forward file (or .qmail as appropriate) in your home directory containing the below lines, but replacing user with your username (which you can discover by entering whoami
) and entering the correct procmail path (which you can discover with which procmail
):
...
How do I use SpamAssassin with procmail?
Now, edit or create a .procmailrc file in your home directory containing the below lines, which come from the \[http://spamassassin.apache.org/full/3.0.x/dist/procmailrc.example procmailrc.example\]. Wiki Markup
No Format |
---|
# SpamAssassin sample procmailrc # # Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc' # if you use the spamc/spamd combination) # # The condition line ensures that only messages smaller than 250 kB # (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam # isn't bigger than a few k and working with big messages can bring # SpamAssassin to its knees. # # The lock file ensures that only 1 spamassassin invocation happens # at 1 time, to keep the load down. # :0fw: spamassassin.lock * < 256000 | spamassassin # Mails with a score of 15 or higher are almost certainly spam (with 0.05% # false positives according to rules/STATISTICS.txt). Let's put them in a # different mbox. (This one is optional.) :0: * ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* almost-certainly-spam # All mail tagged as spam (eg. with a score higher than the set threshold) # is moved to "probably-spam". :0: * ^X-Spam-Status: Yes probably-spam # Work around procmail bug: any output on stderr will cause the "F" in "From" # to be dropped. This will re-add it. :0 * ^^rom[ ] { LOG="*** Dropped F off From_ header! Fixing up. " :0 fhw | sed -e '1s/^/F/' } |
...
Another common (but more complicated) use of procmail is to forward mail to another account, after processing with SpamAssassin. This can also support mistake-based Bayes training. See ProcmailToForwardMail.
The \[http://spamassassin.apache.org/doc/spamc.html spamc\] client program can be used instead of \[http://spamassassin.apache.org/doc/spamassassin.html spamassassin\], if you intend to install and use the \[http://spamassassin.apache.org/doc/spamd.html spamd\] server system-wide.unmigrated-wiki-markup Wiki Markup
Read \[http://mirrors.ccs.neu.edu/cgi-bin/unixhelp/man-cgi?procmailrc 'man procmailrc'\] and \[http://mirrors.ccs.neu.edu/cgi-bin/unixhelp/man-cgi?procmailex 'man procmailex'\] for further details and explanation.