Previous: Spam Statistics Filtering, Up: Spam Back Ends

9.17.6.11 Using SpamOracle with Gnus

An easy way to filter out spam is to use SpamOracle. SpamOracle is an statistical mail filtering tool written by Xavier Leroy and needs to be installed separately.

There are several ways to use SpamOracle with Gnus. In all cases, your mail is piped through SpamOracle in its mark mode. SpamOracle will then enter an ‘X-Spam’ header indicating whether it regards the mail as a spam mail or not.

One possibility is to run SpamOracle as a :prescript from the See Mail Source Specifiers, (see SpamAssassin). This method has the advantage that the user can see the X-Spam headers.

The easiest method is to make spam.el (see Spam Package) call SpamOracle.

To enable SpamOracle usage by spam.el, set the variable spam-use-spamoracle to t and configure the nnmail-split-fancy or nnimap-split-fancy. See Spam Package. In this example the ‘INBOX’ of an nnimap server is filtered using SpamOracle. Mails recognized as spam mails will be moved to spam-split-group, ‘Junk’ in this case. Ham messages stay in ‘INBOX’:

     (setq spam-use-spamoracle t
           spam-split-group "Junk"
           ;; for nnimap you'll probably want to set nnimap-split-methods, see the manual
           nnimap-split-inbox '("INBOX")
           nnimap-split-fancy '(| (: spam-split) "INBOX"))
— Variable: spam-use-spamoracle

Set to t if you want Gnus to enable spam filtering using SpamOracle.

— Variable: spam-spamoracle-binary

Gnus uses the SpamOracle binary called spamoracle found in the user's PATH. Using the variable spam-spamoracle-binary, this can be customized.

— Variable: spam-spamoracle-database

By default, SpamOracle uses the file ~/.spamoracle.db as a database to store its analysis. This is controlled by the variable spam-spamoracle-database which defaults to nil. That means the default SpamOracle database will be used. In case you want your database to live somewhere special, set spam-spamoracle-database to this path.

SpamOracle employs a statistical algorithm to determine whether a message is spam or ham. In order to get good results, meaning few false hits or misses, SpamOracle needs training. SpamOracle learns the characteristics of your spam mails. Using the add mode (training mode) one has to feed good (ham) and spam mails to SpamOracle. This can be done by pressing | in the Summary buffer and pipe the mail to a SpamOracle process or using spam.el's spam- and ham-processors, which is much more convenient. For a detailed description of spam- and ham-processors, See Spam Package.

— Variable: gnus-group-spam-exit-processor-spamoracle

Add this symbol to a group's spam-process parameter by customizing the group parameter or the gnus-spam-process-newsgroups variable. When this symbol is added to a group's spam-process parameter, spam-marked articles will be sent to SpamOracle as spam samples.

WARNING

Instead of the obsolete gnus-group-spam-exit-processor-spamoracle, it is recommended that you use (spam spam-use-spamoracle). Everything will work the same way, we promise.

— Variable: gnus-group-ham-exit-processor-spamoracle

Add this symbol to a group's spam-process parameter by customizing the group parameter or the gnus-spam-process-newsgroups variable. When this symbol is added to a group's spam-process parameter, the ham-marked articles in ham groups will be sent to the SpamOracle as samples of ham messages.

WARNING

Instead of the obsolete gnus-group-ham-exit-processor-spamoracle, it is recommended that you use (ham spam-use-spamoracle). Everything will work the same way, we promise.

Example: These are the Group Parameters of a group that has been classified as a ham group, meaning that it should only contain ham messages.

      ((spam-contents gnus-group-spam-classification-ham)
       (spam-process ((ham spam-use-spamoracle)
                      (spam spam-use-spamoracle))))

For this group the spam-use-spamoracle is installed for both ham and spam processing. If the group contains spam message (e.g., because SpamOracle has not had enough sample messages yet) and the user marks some messages as spam messages, these messages will be processed by SpamOracle. The processor sends the messages to SpamOracle as new samples for spam.