annotate lisp/mh-e/mh-junk.el @ 101132:68290865ac99

*** empty log message ***
author Juri Linkov <juri@jurta.org>
date Sun, 11 Jan 2009 23:07:18 +0000
parents 5f4e85fd7c0a
children 7a9cb1f2769b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
1 ;;; mh-junk.el --- MH-E interface to anti-spam measures
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
2
101078
5f4e85fd7c0a Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
5f4e85fd7c0a Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
4 ;; Free Software Foundation, Inc.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
5
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
6 ;; Author: Satyaki Das <satyaki@theforce.stanford.edu>,
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
7 ;; Bill Wohler <wohler@newt.com>
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
8 ;; Maintainer: Bill Wohler <wohler@newt.com>
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
9 ;; Keywords: mail, spam
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
10
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
12
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79713
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79713
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79713
diff changeset
16 ;; (at your option) any later version.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
17
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
21 ;; GNU General Public License for more details.
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
22
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79713
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
25
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
26 ;;; Commentary:
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
27
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
28 ;; Spam handling in MH-E.
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
29
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
30 ;;; Change Log:
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
31
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
32 ;;; Code:
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
33
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
34 (require 'mh-e)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
35 (require 'mh-scan)
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
36 (mh-require-cl)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
37
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
38 ;;;###mh-autoload
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
39 (defun mh-junk-blacklist (range)
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
40 "Blacklist RANGE as spam.
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
41
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
42 This command trains the spam program in use (see the option
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
43 `mh-junk-program') with the content of RANGE and then handles the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
44 message(s) as specified by the option `mh-junk-disposition'.
67313
2ae99b10dd40 * mh-comp.el (mh-forward): Went over all uses of the word "RANGE" in
Bill Wohler <wohler@newt.com>
parents: 67244
diff changeset
45
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
46 Check the documentation of `mh-interactive-range' to see how RANGE is
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
47 read in interactive use.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
48
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
49 For more information about using your particular spam fighting
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
50 program, see:
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
51
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
52 - `mh-spamassassin-blacklist'
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
53 - `mh-bogofilter-blacklist'
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
54 - `mh-spamprobe-blacklist'"
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
55 (interactive (list (mh-interactive-range "Blacklist")))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
56 (let ((blacklist-func (nth 1 (assoc mh-junk-choice mh-junk-function-alist))))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
57 (unless blacklist-func
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
58 (error "Customize `mh-junk-program' appropriately"))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
59 (let ((dest (cond ((null mh-junk-disposition) nil)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
60 ((equal mh-junk-disposition "") "+")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
61 ((eq (aref mh-junk-disposition 0) ?+)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
62 mh-junk-disposition)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
63 ((eq (aref mh-junk-disposition 0) ?@)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
64 (concat mh-current-folder "/"
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
65 (substring mh-junk-disposition 1)))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
66 (t (concat "+" mh-junk-disposition)))))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
67 (mh-iterate-on-range msg range
65595
8e711c68e4ff message format spec fixes, commit 14, this should be final commit
Deepak Goel <deego@gnufans.org>
parents: 64085
diff changeset
68 (message "Blacklisting message %d..." msg)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
69 (funcall (symbol-function blacklist-func) msg)
65595
8e711c68e4ff message format spec fixes, commit 14, this should be final commit
Deepak Goel <deego@gnufans.org>
parents: 64085
diff changeset
70 (message "Blacklisting message %d...done" msg)
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
71 (if (not (memq msg mh-seen-list))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
72 (setq mh-seen-list (cons msg mh-seen-list)))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
73 (if dest
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
74 (mh-refile-a-msg nil (intern dest))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
75 (mh-delete-a-msg nil)))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
76 (mh-next-msg))))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
77
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
78 ;;;###mh-autoload
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
79 (defun mh-junk-whitelist (range)
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
80 "Whitelist RANGE as ham.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
81
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
82 This command reclassifies the RANGE as ham if it were incorrectly
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
83 classified as spam (see the option `mh-junk-program'). It then
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
84 refiles the message into the \"+inbox\" folder.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
85
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
86 Check the documentation of `mh-interactive-range' to see how
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
87 RANGE is read in interactive use."
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
88 (interactive (list (mh-interactive-range "Whitelist")))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
89 (let ((whitelist-func (nth 2 (assoc mh-junk-choice mh-junk-function-alist))))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
90 (unless whitelist-func
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
91 (error "Customize `mh-junk-program' appropriately"))
56406
d36b00b98db0 Upgraded to MH-E version 7.4.4.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
92 (mh-iterate-on-range msg range
65595
8e711c68e4ff message format spec fixes, commit 14, this should be final commit
Deepak Goel <deego@gnufans.org>
parents: 64085
diff changeset
93 (message "Whitelisting message %d..." msg)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
94 (funcall (symbol-function whitelist-func) msg)
65595
8e711c68e4ff message format spec fixes, commit 14, this should be final commit
Deepak Goel <deego@gnufans.org>
parents: 64085
diff changeset
95 (message "Whitelisting message %d...done" msg)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
96 (mh-refile-a-msg nil (intern mh-inbox)))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
97 (mh-next-msg)))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
98
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
99
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
100
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
101 ;; Spamassassin Interface
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
102
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
103 (defvar mh-spamassassin-executable (executable-find "spamassassin"))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
104 (defvar mh-sa-learn-executable (executable-find "sa-learn"))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
105
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
106 ;;;###mh-autoload
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
107 (defun mh-spamassassin-blacklist (msg)
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
108 "Blacklist MSG with SpamAssassin.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
109
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
110 SpamAssassin is one of the more popular spam filtering programs.
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
111 Get it from your local distribution or from
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
112 http://spamassassin.org/.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
113
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
114 To use SpamAssassin, add the following recipes to
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
115 \".procmailrc\":
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
116
73130
1e5bc57805bc mh-junk.el (mh-spamassassin-whitelist): Add two missing
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 68465
diff changeset
117 PATH=$PATH:/usr/bin/mh
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
118 MAILDIR=$HOME/`mhparam Path`
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
119
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
120 # Fight spam with SpamAssassin.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
121 :0fw
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
122 | spamc
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
123
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
124 # Anything with a spam level of 10 or more is junked immediately.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
125 :0:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
126 * ^X-Spam-Level: ..........
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
127 /dev/null
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
128
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
129 :0:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
130 * ^X-Spam-Status: Yes
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
131 spam/.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
132
67760
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
133 If you don't use \"spamc\", use \"spamassassin -P -a\".
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
134
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
135 Note that one of the recipes above throws away messages with a
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
136 score greater than or equal to 10. Here's how you can determine a
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
137 value that works best for you.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
138
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
139 First, run \"spamassassin -t\" on every mail message in your
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
140 archive and use Gnumeric to verify that the average plus the
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
141 standard deviation of good mail is under 5, the SpamAssassin
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
142 default for \"spam\".
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
143
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
144 Using Gnumeric, sort the messages by score and view the messages
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
145 with the highest score. Determine the score which encompasses all
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
146 of your interesting messages and add a couple of points to be
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
147 conservative. Add that many dots to the \"X-Spam-Level:\" header
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
148 field above to send messages with that score down the drain.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
149
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
150 In the example above, messages with a score of 5-9 are set aside
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
151 in the \"+spam\" folder for later review. The major weakness of
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
152 rules-based filters is a plethora of false positives so it is
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
153 worthwhile to check.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
154
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
155 If SpamAssassin classifies a message incorrectly, or is unsure,
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
156 you can use the MH-E commands \\[mh-junk-blacklist] and
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
157 \\[mh-junk-whitelist].
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
158
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
159 The command \\[mh-junk-blacklist] adds a \"blacklist_from\" entry
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
160 to \"~/spamassassin/user_prefs\", deletes the message, and sends
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
161 the message to the Razor, so that others might not see this spam.
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
162 If the \"sa-learn\" command is available, the message is also
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
163 recategorized as spam.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
164
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
165 The command \\[mh-junk-whitelist] adds a \"whitelist_from\" rule
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
166 to the \"~/.spamassassin/user_prefs\" file. If the \"sa-learn\"
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
167 command is available, the message is also recategorized as ham.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
168
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
169 Over time, you'll observe that the same host or domain occurs
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
170 repeatedly in the \"blacklist_from\" entries, so you might think
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
171 that you could avoid future spam by blacklisting all mail from a
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
172 particular domain. The utility function
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
173 `mh-spamassassin-identify-spammers' helps you do precisely that.
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
174 This function displays a frequency count of the hosts and domains
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
175 in the \"blacklist_from\" entries from the last blank line in
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
176 \"~/.spamassassin/user_prefs\" to the end of the file. This
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
177 information can be used so that you can replace multiple
67760
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
178 \"blacklist_from\" entries with a single wildcard entry such as:
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
179
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
180 blacklist_from *@*amazingoffersdirect2u.com
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
181
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
182 In versions of SpamAssassin (2.50 and on) that support a Bayesian
67988
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
183 classifier, \\[mh-junk-blacklist] uses the program \"sa-learn\"
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
184 to recategorize the message as spam. Neither MH-E, nor
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
185 SpamAssassin, rebuilds the database after adding words, so you
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
186 will need to run \"sa-learn --rebuild\" periodically. This can be
7882fc7df359 * mh-alias.el (mh-alias-grab-from-field): Remove leading * from
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
187 done by adding the following to your crontab:
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
188
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
189 0 * * * * sa-learn --rebuild > /dev/null 2>&1"
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
190 (unless mh-spamassassin-executable
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
191 (error "Unable to find the spamassassin executable"))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
192 (let ((current-folder mh-current-folder)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
193 (msg-file (mh-msg-filename msg mh-current-folder))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
194 (sender))
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
195 (message "Reporting message %d..." msg)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
196 (mh-truncate-log-buffer)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
197 ;; Put call-process output in log buffer if we are saving it
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
198 ;; (this happens if mh-junk-background is t).
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
199 (with-current-buffer mh-log-buffer
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
200 (call-process mh-spamassassin-executable msg-file mh-junk-background nil
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
201 ;;"--report" "--remove-from-whitelist"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
202 "-r" "-R") ; spamassassin V2.20
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
203 (when mh-sa-learn-executable
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
204 (message "Recategorizing message %d as spam..." msg)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
205 (mh-truncate-log-buffer)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
206 (call-process mh-sa-learn-executable msg-file mh-junk-background nil
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
207 "--single" "--spam" "--local" "--no-rebuild")))
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
208 (message "Blacklisting sender of message %d..." msg)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
209 (with-current-buffer (get-buffer-create mh-temp-buffer)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
210 (erase-buffer)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
211 (call-process (expand-file-name mh-scan-prog mh-progs)
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
212 nil t nil
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
213 (format "%d" msg) current-folder
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
214 "-format" "%<(mymbox{from})%|%(addr{from})%>")
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
215 (goto-char (point-min))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
216 (if (search-forward-regexp "^\\(.+\\)$" nil t)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
217 (progn
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
218 (setq sender (match-string 0))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
219 (mh-spamassassin-add-rule "blacklist_from" sender)
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
220 (message "Blacklisting sender of message %d...done" msg))
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
221 (message "Blacklisting sender of message %d...not done (from my address)" msg)))))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
222
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
223 ;;;###mh-autoload
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
224 (defun mh-spamassassin-whitelist (msg)
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
225 "Whitelist MSG with SpamAssassin.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
226
67760
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
227 The \\[mh-junk-whitelist] command adds a \"whitelist_from\" rule to
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
228 the \"~/.spamassassin/user_prefs\" file. If the \"sa-learn\" command
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
229 is available, the message is also recategorized as ham.
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
230
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
231 See `mh-spamassassin-blacklist' for more information."
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
232 (unless mh-spamassassin-executable
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
233 (error "Unable to find the spamassassin executable"))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
234 (let ((msg-file (mh-msg-filename msg mh-current-folder))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
235 (show-buffer (get-buffer mh-show-buffer))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
236 from)
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
237 (with-current-buffer (get-buffer-create mh-temp-buffer)
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
238 (erase-buffer)
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
239 (message "Removing spamassassin markup from message %d..." msg)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
240 (call-process mh-spamassassin-executable msg-file t nil
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
241 ;; "--remove-markup"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
242 "-d") ; spamassassin V2.20
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
243 (if show-buffer
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
244 (kill-buffer show-buffer))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
245 (write-file msg-file)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
246 (when mh-sa-learn-executable
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
247 (message "Recategorizing message %d as ham..." msg)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
248 (mh-truncate-log-buffer)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
249 ;; Put call-process output in log buffer if we are saving it
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
250 ;; (this happens if mh-junk-background is t).
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
251 (with-current-buffer mh-log-buffer
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
252 (call-process mh-sa-learn-executable msg-file mh-junk-background nil
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
253 "--single" "--ham" "--local" "--no-rebuild")))
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
254 (message "Whitelisting sender of message %d..." msg)
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
255 (setq from
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
256 (car (mh-funcall-if-exists
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
257 ietf-drums-parse-address (mh-get-header-field "From:"))))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
258 (kill-buffer nil)
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
259 (unless (or (null from) (equal from ""))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
260 (mh-spamassassin-add-rule "whitelist_from" from))
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
261 (message "Whitelisting sender of message %d...done" msg))))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
262
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
263 (defun mh-spamassassin-add-rule (rule body)
67760
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
264 "Add a new rule to \"~/.spamassassin/user_prefs\".
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
265 The name of the rule is RULE and its body is BODY."
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
266 (save-window-excursion
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
267 (let* ((line (format "%s\t%s\n" rule body))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
268 (case-fold-search t)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
269 (file (expand-file-name "~/.spamassassin/user_prefs"))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
270 (buffer-exists (find-buffer-visiting file)))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
271 (find-file file)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
272 (if (not (search-forward (format "\n%s" line) nil t))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
273 (progn
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
274 (goto-char (point-max))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
275 (insert (if (bolp) "" "\n") line)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
276 (save-buffer)))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
277 (if (not buffer-exists)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
278 (kill-buffer nil)))))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
279
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
280 ;;;###mh-autoload
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
281 (defun mh-spamassassin-identify-spammers ()
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
282 "Identify spammers who are repeat offenders.
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
283
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
284 This function displays a frequency count of the hosts and domains
67760
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
285 in the \"blacklist_from\" entries from the last blank line in
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
286 \"~/.spamassassin/user_prefs\" to the end of the file. This
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
287 information can be used so that you can replace multiple
67760
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
288 \"blacklist_from\" entries with a single wildcard entry such as:
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
289
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
290 blacklist_from *@*amazingoffersdirect2u.com"
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
291 (interactive)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
292 (let* ((file (expand-file-name "~/.spamassassin/user_prefs"))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
293 (domains (make-hash-table :test 'equal)))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
294 (find-file file)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
295 ;; Only consider entries between last blank line and end of file.
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
296 (goto-char (1- (point-max)))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
297 (search-backward-regexp "^$")
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
298 ;; Perform frequency count.
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
299 (save-excursion
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
300 (while (search-forward-regexp "^blacklist_from\\s-*\\(.*\\)@\\(.*\\)$"
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
301 nil t)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
302 (let ((host (match-string 2))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
303 value)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
304 ;; Remove top-level-domain from hostname.
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
305 (setq host (cdr (reverse (split-string host "\\."))))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
306 ;; Add counts for each host and domain part.
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
307 (while host
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
308 (setq value (gethash (car host) domains))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
309 (setf (gethash (car host) domains) (1+ (if (not value) 0 value)))
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
310 (setq host (cdr host))))))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
311
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
312 ;; Output
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
313 (delete-other-windows)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
314 (pop-to-buffer (get-buffer-create "*MH-E Spammer Frequencies*"))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
315 (erase-buffer)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
316 (maphash '(lambda (key value) ""
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
317 (if (> value 2)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
318 (insert (format "%s %s\n" key value))))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
319 domains)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
320 (sort-numeric-fields 2 (point-min) (point-max))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
321 (reverse-region (point-min) (point-max))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
322 (goto-char (point-min))))
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
323
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
324
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
325
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
326 ;; Bogofilter Interface
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
327
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
328 (defvar mh-bogofilter-executable (executable-find "bogofilter"))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
329
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
330 ;;;###mh-autoload
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
331 (defun mh-bogofilter-blacklist (msg)
67244
6521056180e7 (mh-bogofilter-blacklist, mh-bogofilter-whitelist): Bogofilter is
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
332 "Blacklist MSG with bogofilter.
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
333
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
334 Bogofilter is a Bayesian spam filtering program. Get it from your
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
335 local distribution or from http://bogofilter.sourceforge.net/.
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
336
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
337 Bogofilter is taught by running:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
338
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
339 bogofilter -n < good-message
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
340
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
341 on every good message, and
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
342
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
343 bogofilter -s < spam-message
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
344
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
345 on every spam message. This is called a full training; three other
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
346 training methods are described in the FAQ that is distributed with
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
347 bogofilter. Note that most Bayesian filters need 1000 to 5000 of each
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
348 type of message to start doing a good job.
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
349
67760
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
350 To use bogofilter, add the following recipes to \".procmailrc\":
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
351
73959
d67b3c1597d8 (mh-spamassassin-blacklist, mh-bogofilter-blacklist)
Bill Wohler <wohler@newt.com>
parents: 73924
diff changeset
352 PATH=$PATH:/usr/bin/mh
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
353 MAILDIR=$HOME/`mhparam Path`
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
354
67244
6521056180e7 (mh-bogofilter-blacklist, mh-bogofilter-whitelist): Bogofilter is
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
355 # Fight spam with bogofilter.
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
356 :0fw
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
357 | bogofilter -3 -e -p
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
358
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
359 :0:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
360 * ^X-Bogosity: Yes, tests=bogofilter
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
361 spam/.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
362
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
363 :0:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
364 * ^X-Bogosity: Unsure, tests=bogofilter
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
365 spam/unsure/.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
366
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
367 If bogofilter classifies a message incorrectly, or is unsure, you can
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
368 use the MH-E commands \\[mh-junk-blacklist] and \\[mh-junk-whitelist]
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
369 to update bogofilter's training.
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
370
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
371 The \"Bogofilter FAQ\" suggests that you run the following
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
372 occasionally to shrink the database:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
373
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
374 bogoutil -d wordlist.db | bogoutil -l wordlist.db.new
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
375 mv wordlist.db wordlist.db.prv
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
376 mv wordlist.db.new wordlist.db
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
377
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
378 The \"Bogofilter tuning HOWTO\" describes how you can fine-tune Bogofilter."
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
379 (unless mh-bogofilter-executable
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
380 (error "Unable to find the bogofilter executable"))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
381 (let ((msg-file (mh-msg-filename msg mh-current-folder)))
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
382 (mh-truncate-log-buffer)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
383 ;; Put call-process output in log buffer if we are saving it
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
384 ;; (this happens if mh-junk-background is t).
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
385 (with-current-buffer mh-log-buffer
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
386 (call-process mh-bogofilter-executable msg-file mh-junk-background
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
387 nil "-s"))))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
388
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
389 ;;;###mh-autoload
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
390 (defun mh-bogofilter-whitelist (msg)
67244
6521056180e7 (mh-bogofilter-blacklist, mh-bogofilter-whitelist): Bogofilter is
Bill Wohler <wohler@newt.com>
parents: 65980
diff changeset
391 "Whitelist MSG with bogofilter.
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
392
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
393 See `mh-bogofilter-blacklist' for more information."
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
394 (unless mh-bogofilter-executable
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
395 (error "Unable to find the bogofilter executable"))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
396 (let ((msg-file (mh-msg-filename msg mh-current-folder)))
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
397 (mh-truncate-log-buffer)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
398 ;; Put call-process output in log buffer if we are saving it
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
399 ;; (this happens if mh-junk-background is t).
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
400 (with-current-buffer mh-log-buffer
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
401 (call-process mh-bogofilter-executable msg-file mh-junk-background
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
402 nil "-n"))))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
403
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
404
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
405
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
406 ;; Spamprobe Interface
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
407
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
408 (defvar mh-spamprobe-executable (executable-find "spamprobe"))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
409
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
410 ;;;###mh-autoload
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
411 (defun mh-spamprobe-blacklist (msg)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
412 "Blacklist MSG with SpamProbe.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
413
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
414 SpamProbe is a Bayesian spam filtering program. Get it from your local
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
415 distribution or from http://spamprobe.sourceforge.net.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
416
67760
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
417 To use SpamProbe, add the following recipes to \".procmailrc\":
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
418
73959
d67b3c1597d8 (mh-spamassassin-blacklist, mh-bogofilter-blacklist)
Bill Wohler <wohler@newt.com>
parents: 73924
diff changeset
419 PATH=$PATH:/usr/bin/mh
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
420 MAILDIR=$HOME/`mhparam Path`
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
421
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
422 # Fight spam with SpamProbe.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
423 :0
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
424 SCORE=| spamprobe receive
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
425
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
426 :0 wf
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
427 | formail -I \"X-SpamProbe: $SCORE\"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
428
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
429 :0:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
430 *^X-SpamProbe: SPAM
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
431 spam/.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
432
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
433 If SpamProbe classifies a message incorrectly, you can use the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
434 MH-E commands \\[mh-junk-blacklist] and \\[mh-junk-whitelist] to
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
435 update SpamProbe's training."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
436 (unless mh-spamprobe-executable
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
437 (error "Unable to find the spamprobe executable"))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
438 (let ((msg-file (mh-msg-filename msg mh-current-folder)))
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
439 (mh-truncate-log-buffer)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
440 ;; Put call-process output in log buffer if we are saving it
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
441 ;; (this happens if mh-junk-background is t).
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
442 (with-current-buffer mh-log-buffer
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
443 (call-process mh-spamprobe-executable msg-file mh-junk-background
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
444 nil "spam"))))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
445
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68199
diff changeset
446 ;;;###mh-autoload
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
447 (defun mh-spamprobe-whitelist (msg)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
448 "Whitelist MSG with SpamProbe.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
449
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
450 See `mh-spamprobe-blacklist' for more information."
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
451 (unless mh-spamprobe-executable
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
452 (error "Unable to find the spamprobe executable"))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
453 (let ((msg-file (mh-msg-filename msg mh-current-folder)))
73924
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
454 (mh-truncate-log-buffer)
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
455 ;; Put call-process output in log buffer if we are saving it
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
456 ;; (this happens if mh-junk-background is t).
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
457 (with-current-buffer mh-log-buffer
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
458 (call-process mh-spamprobe-executable msg-file mh-junk-background
63fc0820b362 mh-junk.el (mh-spamassassin-blacklist, mh-spamassassin-whitelist):
Stephen Gildea <gildea@stop.mail-abuse.org>
parents: 73130
diff changeset
459 nil "good"))))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
460
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
461 (provide 'mh-junk)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
462
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
463 ;; Local Variables:
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
464 ;; indent-tabs-mode: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
465 ;; sentence-end-double-space: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
466 ;; End:
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
467
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 67313
diff changeset
468 ;; arch-tag: 603335f1-77ff-4306-8828-5d3dad51abe1
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents:
diff changeset
469 ;;; mh-junk.el ends here