1 ;;; spam.el --- Identifying spam
2 ;; Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
26 ;;; This module addresses a few aspects of spam control under Gnus. Page
27 ;;; breaks are used for grouping declarations and documentation relating to
28 ;;; each particular aspect.
30 ;;; The integration with Gnus is not yet complete. See various `FIXME'
31 ;;; comments, below, for supplementary explanations or discussions.
33 ;;; Several TODO items are marked as such
39 (require 'gnus-uu) ; because of key prefix issues
40 (require 'gnus) ; for the definitions of group content classification and spam processors
41 (require 'message) ;for the message-fetch-field functions
43 ;; for nnimap-split-download-body-default
44 (eval-when-compile (require 'nnimap))
46 ;; autoload executable-find
48 ;; executable-find is not autoloaded in Emacs 20
49 (autoload 'executable-find "executable"))
53 (autoload 'query-dig "dig"))
57 (autoload 'query-dns "dns"))
62 "Spam configuration.")
64 (defcustom spam-directory "~/News/spam/"
65 "Directory for spam whitelists and blacklists."
69 (defcustom spam-move-spam-nonspam-groups-only t
70 "Whether spam should be moved in non-spam groups only.
71 When nil, only ham and unclassified groups will have their spam moved
72 to the spam-process-destination. When t, spam will also be moved from
77 (defcustom spam-mark-ham-unread-before-move-from-spam-group nil
78 "Whether ham should be marked unread before it's moved out of a spam
79 group according to ham-process-destination. This variable is an
80 official entry in the international Longest Variable Name
85 (defcustom spam-whitelist (expand-file-name "whitelist" spam-directory)
86 "The location of the whitelist.
87 The file format is one regular expression per line.
88 The regular expression is matched against the address."
92 (defcustom spam-blacklist (expand-file-name "blacklist" spam-directory)
93 "The location of the blacklist.
94 The file format is one regular expression per line.
95 The regular expression is matched against the address."
99 (defcustom spam-use-dig t
100 "Whether query-dig should be used instead of query-dns."
104 (defcustom spam-use-blacklist nil
105 "Whether the blacklist should be used by spam-split."
109 (defcustom spam-use-whitelist nil
110 "Whether the whitelist should be used by spam-split."
114 (defcustom spam-use-whitelist-exclusive nil
115 "Whether whitelist-exclusive should be used by spam-split.
116 Exclusive whitelisting means that all messages from senders not in the whitelist
117 are considered spam."
121 (defcustom spam-use-blackholes nil
122 "Whether blackholes should be used by spam-split."
126 (defcustom spam-use-hashcash nil
127 "Whether hashcash payments should be detected by spam-split."
131 (defcustom spam-use-regex-headers nil
132 "Whether a header regular expression match should be used by spam-split.
133 Also see the variable `spam-spam-regex-headers' and `spam-ham-regex-headers'."
137 (defcustom spam-use-bogofilter-headers nil
138 "Whether bogofilter headers should be used by spam-split.
139 Enable this if you pre-process messages with Bogofilter BEFORE Gnus sees them."
143 (defcustom spam-use-bogofilter nil
144 "Whether bogofilter should be invoked by spam-split.
145 Enable this if you want Gnus to invoke Bogofilter on new messages."
149 (defcustom spam-use-BBDB nil
150 "Whether BBDB should be used by spam-split."
154 (defcustom spam-use-BBDB-exclusive nil
155 "Whether BBDB-exclusive should be used by spam-split.
156 Exclusive BBDB means that all messages from send