comparison lisp/mh-e/mh-junk.el @ 67760:9c3504ae6060

Follow MH-E Developers Guide conventions. Use `' quotes for Help hyperlinks such as symbols, Info nodes, or URLs. Use \" quotes for everything else. Otherwise, you can accidently get links to nonsense symbols.
author Bill Wohler <wohler@newt.com>
date Fri, 23 Dec 2005 08:40:31 +0000
parents 6b063593fdad
children 7882fc7df359
comparison
equal deleted inserted replaced
67759:b7b75914a27d 67760:9c3504ae6060
109 "Blacklist MSG with SpamAssassin. 109 "Blacklist MSG with SpamAssassin.
110 110
111 SpamAssassin is one of the more popular spam filtering programs. Get 111 SpamAssassin is one of the more popular spam filtering programs. Get
112 it from your local distribution or from http://spamassassin.org/. 112 it from your local distribution or from http://spamassassin.org/.
113 113
114 To use SpamAssassin, add the following recipes to `.procmailrc': 114 To use SpamAssassin, add the following recipes to \".procmailrc\":
115 115
116 MAILDIR=$HOME/`mhparam Path` 116 MAILDIR=$HOME/`mhparam Path`
117 117
118 # Fight spam with SpamAssassin. 118 # Fight spam with SpamAssassin.
119 :0fw 119 :0fw
126 126
127 :0: 127 :0:
128 * ^X-Spam-Status: Yes 128 * ^X-Spam-Status: Yes
129 spam/. 129 spam/.
130 130
131 If you don't use `spamc', use `spamassassin -P -a'. 131 If you don't use \"spamc\", use \"spamassassin -P -a\".
132 132
133 Note that one of the recipes above throws away messages with a score 133 Note that one of the recipes above throws away messages with a score
134 greater than or equal to 10. Here's how you can determine a value that 134 greater than or equal to 10. Here's how you can determine a value that
135 works best for you. 135 works best for you.
136 136
137 First, run `spamassassin -t' on every mail message in your archive and 137 First, run \"spamassassin -t\" on every mail message in your archive and
138 use Gnumeric to verify that the average plus the standard deviation of 138 use Gnumeric to verify that the average plus the standard deviation of
139 good mail is under 5, the SpamAssassin default for \"spam\". 139 good mail is under 5, the SpamAssassin default for \"spam\".
140 140
141 Using Gnumeric, sort the messages by score and view the messages with 141 Using Gnumeric, sort the messages by score and view the messages with
142 the highest score. Determine the score which encompasses all of your 142 the highest score. Determine the score which encompasses all of your
143 interesting messages and add a couple of points to be conservative. 143 interesting messages and add a couple of points to be conservative.
144 Add that many dots to the `X-Spam-Level:' header field above to send 144 Add that many dots to the \"X-Spam-Level:\" header field above to send
145 messages with that score down the drain. 145 messages with that score down the drain.
146 146
147 In the example above, messages with a score of 5-9 are set aside in 147 In the example above, messages with a score of 5-9 are set aside in
148 the `+spam' folder for later review. The major weakness of rules-based 148 the \"+spam\" folder for later review. The major weakness of rules-based
149 filters is a plethora of false positives so it is worthwhile to check. 149 filters is a plethora of false positives so it is worthwhile to check.
150 150
151 If SpamAssassin classifies a message incorrectly, or is unsure, you 151 If SpamAssassin classifies a message incorrectly, or is unsure, you
152 can use the MH-E commands \\[mh-junk-blacklist] and 152 can use the MH-E commands \\[mh-junk-blacklist] and
153 \\[mh-junk-whitelist]. 153 \\[mh-junk-whitelist].
154 154
155 The \\[mh-junk-blacklist] command adds a `blacklist_from' entry to 155 The \\[mh-junk-blacklist] command adds a \"blacklist_from\" entry to
156 `~/spamassassin/user_prefs', deletes the message, and sends the 156 \"~/spamassassin/user_prefs\", deletes the message, and sends the
157 message to the Razor, so that others might not see this spam. If the 157 message to the Razor, so that others might not see this spam. If the
158 `sa-learn' command is available, the message is also recategorized as 158 \"sa-learn\" command is available, the message is also recategorized as
159 spam. 159 spam.
160 160
161 The \\[mh-junk-whitelist] command adds a `whitelist_from' rule to the 161 The \\[mh-junk-whitelist] command adds a \"whitelist_from\" rule to the
162 `~/.spamassassin/user_prefs' file. If the `sa-learn' command is 162 \"~/.spamassassin/user_prefs\" file. If the \"sa-learn\" command is
163 available, the message is also recategorized as ham. 163 available, the message is also recategorized as ham.
164 164
165 Over time, you'll observe that the same host or domain occurs 165 Over time, you'll observe that the same host or domain occurs
166 repeatedly in the `blacklist_from' entries, so you might think that 166 repeatedly in the \"blacklist_from\" entries, so you might think that
167 you could avoid future spam by blacklisting all mail from a particular 167 you could avoid future spam by blacklisting all mail from a particular
168 domain. The utility function `mh-spamassassin-identify-spammers' helps 168 domain. The utility function `mh-spamassassin-identify-spammers' helps
169 you do precisely that. This function displays a frequency count of the 169 you do precisely that. This function displays a frequency count of the
170 hosts and domains in the `blacklist_from' entries from the last blank 170 hosts and domains in the \"blacklist_from\" entries from the last blank
171 line in `~/.spamassassin/user_prefs' to the end of the file. This 171 line in \"~/.spamassassin/user_prefs\" to the end of the file. This
172 information can be used so that you can replace multiple 172 information can be used so that you can replace multiple
173 `blacklist_from' entries with a single wildcard entry such as: 173 \"blacklist_from\" entries with a single wildcard entry such as:
174 174
175 blacklist_from *@*amazingoffersdirect2u.com 175 blacklist_from *@*amazingoffersdirect2u.com
176 176
177 In versions of SpamAssassin (2.50 and on) that support a Bayesian 177 In versions of SpamAssassin (2.50 and on) that support a Bayesian
178 classifier, \\[mh-junk-blacklist] uses the `sa-learn' program to 178 classifier, \\[mh-junk-blacklist] uses the \"sa-learn\" program to
179 recategorize the message as spam. Neither MH-E, nor SpamAssassin, 179 recategorize the message as spam. Neither MH-E, nor SpamAssassin,
180 rebuilds the database after adding words, so you will need to run 180 rebuilds the database after adding words, so you will need to run
181 `sa-learn --rebuild' periodically. This can be done by adding the 181 \"sa-learn --rebuild\" periodically. This can be done by adding the
182 following to your crontab: 182 following to your crontab:
183 183
184 0 * * * * sa-learn --rebuild > /dev/null 2>&1" 184 0 * * * * sa-learn --rebuild > /dev/null 2>&1"
185 (unless mh-spamassassin-executable 185 (unless mh-spamassassin-executable
186 (error "Unable to find the spamassassin executable")) 186 (error "Unable to find the spamassassin executable"))
213 (message "Blacklisting message %d...not done (from my address)" msg))))) 213 (message "Blacklisting message %d...not done (from my address)" msg)))))
214 214
215 (defun mh-spamassassin-whitelist (msg) 215 (defun mh-spamassassin-whitelist (msg)
216 "Whitelist MSG with SpamAssassin. 216 "Whitelist MSG with SpamAssassin.
217 217
218 The \\[mh-junk-whitelist] command adds a `whitelist_from' rule to 218 The \\[mh-junk-whitelist] command adds a \"whitelist_from\" rule to
219 the `~/.spamassassin/user_prefs' file. If the `sa-learn' command 219 the \"~/.spamassassin/user_prefs\" file. If the \"sa-learn\" command
220 is available, the message is also recategorized as ham. 220 is available, the message is also recategorized as ham.
221 221
222 See `mh-spamassassin-blacklist' for more information." 222 See `mh-spamassassin-blacklist' for more information."
223 (unless mh-spamassassin-executable 223 (unless mh-spamassassin-executable
224 (error "Unable to find the spamassassin executable")) 224 (error "Unable to find the spamassassin executable"))
247 (unless (or (null from) (equal from "")) 247 (unless (or (null from) (equal from ""))
248 (mh-spamassassin-add-rule "whitelist_from" from)) 248 (mh-spamassassin-add-rule "whitelist_from" from))
249 (message "Whitelisting message %d...done" msg)))) 249 (message "Whitelisting message %d...done" msg))))
250 250
251 (defun mh-spamassassin-add-rule (rule body) 251 (defun mh-spamassassin-add-rule (rule body)
252 "Add a new rule to `~/.spamassassin/user_prefs'. 252 "Add a new rule to \"~/.spamassassin/user_prefs\".
253 The name of the rule is RULE and its body is BODY." 253 The name of the rule is RULE and its body is BODY."
254 (save-window-excursion 254 (save-window-excursion
255 (let* ((line (format "%s\t%s\n" rule body)) 255 (let* ((line (format "%s\t%s\n" rule body))
256 (case-fold-search t) 256 (case-fold-search t)
257 (file (expand-file-name "~/.spamassassin/user_prefs")) 257 (file (expand-file-name "~/.spamassassin/user_prefs"))
267 267
268 (defun mh-spamassassin-identify-spammers () 268 (defun mh-spamassassin-identify-spammers ()
269 "Identify spammers who are repeat offenders. 269 "Identify spammers who are repeat offenders.
270 270
271 This function displays a frequency count of the hosts and domains 271 This function displays a frequency count of the hosts and domains
272 in the `blacklist_from' entries from the last blank line in 272 in the \"blacklist_from\" entries from the last blank line in
273 `~/.spamassassin/user_prefs' to the end of the file. This 273 \"~/.spamassassin/user_prefs\" to the end of the file. This
274 information can be used so that you can replace multiple 274 information can be used so that you can replace multiple
275 `blacklist_from' entries with a single wildcard entry such as: 275 \"blacklist_from\" entries with a single wildcard entry such as:
276 276
277 blacklist_from *@*amazingoffersdirect2u.com" 277 blacklist_from *@*amazingoffersdirect2u.com"
278 (interactive) 278 (interactive)
279 (let* ((file (expand-file-name "~/.spamassassin/user_prefs")) 279 (let* ((file (expand-file-name "~/.spamassassin/user_prefs"))
280 (domains (make-hash-table :test 'equal))) 280 (domains (make-hash-table :test 'equal)))
331 on every spam message. This is called a full training; three other 331 on every spam message. This is called a full training; three other
332 training methods are described in the FAQ that is distributed with 332 training methods are described in the FAQ that is distributed with
333 bogofilter. Note that most Bayesian filters need 1000 to 5000 of each 333 bogofilter. Note that most Bayesian filters need 1000 to 5000 of each
334 type of message to start doing a good job. 334 type of message to start doing a good job.
335 335
336 To use bogofilter, add the following recipes to `.procmailrc': 336 To use bogofilter, add the following recipes to \".procmailrc\":
337 337
338 MAILDIR=$HOME/`mhparam Path` 338 MAILDIR=$HOME/`mhparam Path`
339 339
340 # Fight spam with bogofilter. 340 # Fight spam with bogofilter.
341 :0fw 341 :0fw
387 "Blacklist MSG with SpamProbe. 387 "Blacklist MSG with SpamProbe.
388 388
389 SpamProbe is a Bayesian spam filtering program. Get it from your local 389 SpamProbe is a Bayesian spam filtering program. Get it from your local
390 distribution or from http://spamprobe.sourceforge.net. 390 distribution or from http://spamprobe.sourceforge.net.
391 391
392 To use SpamProbe, add the following recipes to `.procmailrc': 392 To use SpamProbe, add the following recipes to \".procmailrc\":
393 393
394 MAILDIR=$HOME/`mhparam Path` 394 MAILDIR=$HOME/`mhparam Path`
395 395
396 # Fight spam with SpamProbe. 396 # Fight spam with SpamProbe.
397 :0 397 :0