Next: Low-level interface to the spam-stat dictionary, Previous: Creating a spam-stat dictionary, Up: Spam Statistics Package

##### 9.18.8.2 Splitting mail using spam-stat

This section describes how to use the Spam statistics independently of the See Spam Package.

First, add the following to your `~/.gnus.el` file:

         (require 'spam-stat)
         (spam-stat-load)

This will load the necessary Gnus code, and the dictionary you created.

Next, you need to adapt your fancy splitting rules: You need to determine how to use `spam-stat`. The following examples are for the nnml back end. Using the nnimap back end works just as well. Just use `nnimap-split-fancy` instead of `nnmail-split-fancy`.

In the simplest case, you only have two groups, ‘`mail.misc`’ and ‘`mail.spam`’. The following expression says that mail is either spam or it should go into ‘`mail.misc`’. If it is spam, then `spam-stat-split-fancy` will return ‘`mail.spam`’.

         (setq nnmail-split-fancy
               `(| (: spam-stat-split-fancy)
                   "mail.misc"))

— Variable: spam-stat-split-fancy-spam-group

> The group to use for spam. Default is ‘`mail.spam`’.

If you also filter mail with specific subjects into other groups, use the following expression. Only mails not matching the regular expression are considered potential spam.

         (setq nnmail-split-fancy
               `(| ("Subject" "\\bspam-stat\\b" "mail.emacs")
                   (: spam-stat-split-fancy)
                   "mail.misc"))

If you want to filter for spam first, then you must be careful when creating the dictionary. Note that `spam-stat-split-fancy` must consider both mails in ‘`mail.emacs`’ and in ‘`mail.misc`’ as non-spam, therefore both should be in your collection of non-spam mails, when creating the dictionary!

         (setq nnmail-split-fancy
               `(| (: spam-stat-split-fancy)
                   ("Subject" "\\bspam-stat\\b" "mail.emacs")
                   "mail.misc"))

You can combine this with traditional filtering. Here, we move all HTML-only mails into the ‘`mail.spam.filtered`’ group. Note that since `spam-stat-split-fancy` will never see them, the mails in ‘`mail.spam.filtered`’ should be neither in your collection of spam mails, nor in your collection of non-spam mails, when creating the dictionary!

         (setq nnmail-split-fancy
               `(| ("Content-Type" "text/html" "mail.spam.filtered")
                   (: spam-stat-split-fancy)
                   ("Subject" "\\bspam-stat\\b" "mail.emacs")
                   "mail.misc"))