Bogofilter implements a fast Bayesian spam filter along the lines suggested by Paul Graham in his article “A Plan For Spam”. Its home page is at

Gnus has its own spam package that can use Bogofilter. Another (and simpler) approach is here: gnus-bogofilter.

Another nice feature is to sort the mails in the spam group with the spamicity, i.e. the spam probability, so that articles with the lowest spam probability are right at the top. This way it is easier to spot false positives, i.e. mails which were wrongly identified as spam (those will usually have a relatively low spam probability).

First you will have to put X-Bogosity into your gnus-extra-headers. I use the following:

(setq gnus-extra-headers '(To Newsgroups X-Bogosity))

Then you can use the following sort function:

(defun DE-gnus-article-sort-by-bogofilter-score (h1 h2)
  (let ((n1 (gnus-extra-header 'X-Bogosity h1))
	(n2 (gnus-extra-header 'X-Bogosity h2)))
	  (string-match "spamicity=\\(.*\\)," n2)
	  (match-string 1 n2)
	;; If X-Bogosity does not exist, set spamicity to 0
	  (string-match "spamicity=\\(.*\\)," n1)
	  (match-string 1 n1)

This function assumes that you didn’t change the default Bogofilter headers in your

CategoryGnus SpamFiltering