(Spam ELisp Package Sequence of Events): explain more
authorTeodor Zlatanov <tzz@lifelogs.com>
Sun, 4 Jan 2004 03:20:18 +0000 (03:20 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Sun, 4 Jan 2004 03:20:18 +0000 (03:20 +0000)
about the sequence of events and what happens with read-only
backends
(Spam ELisp Package Global Variables): explain what happens with
read-only backends
(Spam ELisp Package Configuration Examples): added Reiner Steib
and Ted Zlatanov's setups

texi/ChangeLog
texi/gnus.texi

index 37230bc..12065b6 100644 (file)
@@ -1,3 +1,13 @@
+2004-01-03  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus.texi (Spam ELisp Package Sequence of Events): explain more
+       about the sequence of events and what happens with read-only
+       backends
+       (Spam ELisp Package Global Variables): explain what happens with
+       read-only backends
+       (Spam ELisp Package Configuration Examples): added Reiner Steib
+       and Ted Zlatanov's setups
+
 2004-01-03  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * emacs-mime.texi (Display Customization): Add mm-enable-external.
index 2d84c81..343beb8 100644 (file)
@@ -22630,9 +22630,14 @@ ELisp Package Global Variables}) for further training or deletion.
 You have to load the @code{gnus-registry.el} package and enable the
 @code{spam-log-to-registry} variable if you want spam to be processed
 no more than once.  Thus, spam is detected and processed everywhere,
-which is what most people want.
+which is what most people want.  If the
+@code{spam-process-destination} is nil, the spam is marked as
+expired, which is usually the right thing to do.
 
-If a ham mail is found in a ham group, as determineed by the
+If spam can not be moved - because of a read-only backend such as NNTP,
+for example, it will be copied.
+
+If a ham mail is found in a ham group, as determined by the
 @code{ham-marks} parameter, it is processed as ham by the active ham
 @code{spam-processor} when the group is exited.  With the variables
 @code{spam-process-ham-in-spam-groups} and
@@ -22644,6 +22649,9 @@ no more than once.  Thus, ham is detected and processed only when
 necessary, which is what most people want.  More on this in
 @xref{Spam ELisp Package Configuration Examples}.
 
+If ham can not be moved - because of a read-only backend such as NNTP,
+for example, it will be copied.
+
 If all this seems confusing, don't worry.  Soon it will be as natural
 as typing Lisp one-liners on a neural interface... err, sorry, that's
 50 years in the future yet.  Just trust us, it's not so bad.
@@ -22853,6 +22861,9 @@ left in place.  If the
 @code{spam-mark-ham-unread-before-move-from-spam-group} parameter is
 set, the ham articles are marked as unread before being moved.  
 
+If ham can not be moved - because of a read-only backend such as NNTP,
+for example, it will be copied.
+
 Note that you can use multiples destinations per group or regular
 expression!  This enables you to send your ham to a regular mail
 group and to a @emph{ham training} group.
@@ -22889,6 +22900,9 @@ articles are only expired.  The group name is fully qualified, meaning
 that if you see @samp{nntp:servername} before the group name in the
 group buffer then you need it here as well.  
 
+If spam can not be moved - because of a read-only backend such as NNTP,
+for example, it will be copied.
+
 Note that you can use multiples destinations per group or regular
 expression!  This enables you to send your spam to multiple @emph{spam
 training} groups.
@@ -22925,7 +22939,162 @@ spam.  It is recommended that you leave it off.
 @cindex spam configuration examples
 @cindex spam
 
-@emph{TODO}: add configuration examples with explanations of daily usage
+@example
+;; Ted Zlatanov <tzz@@lifelogs.com>
+
+;; for gnus-registry-split-fancy-with-parent and spam autodetection
+;; see gnus-registry.el for more information
+(gnus-registry-initialize)
+(spam-initialize)
+
+;; I like control-S for marking spam
+(define-key gnus-summary-mode-map "\C-s" 'gnus-summary-mark-as-spam)
+
+(setq
+ spam-log-to-registry t ;; for spam autodetection
+ spam-use-BBDB t
+ spam-use-regex-headers t               ; catch X-Spam-Flag (SpamAssassin)
+ ;; all groups with "spam" in the name contain spam
+ gnus-spam-newsgroup-contents '(("spam" gnus-group-spam-classification-spam))
+ ;; see documentation for these
+ spam-move-spam-nonspam-groups-only nil
+ spam-mark-only-unseen-as-spam t
+ spam-mark-ham-unread-before-move-from-spam-group t
+ nnimap-split-rule 'nnimap-split-fancy
+ ;; understand what this does before you copy it to your own setup!
+ nnimap-split-fancy '(|
+                      ;; trace references to parents and put in their group
+                      (: gnus-registry-split-fancy-with-parent)
+                      ;; this will catch server-side SpamAssassin tags
+                      (: spam-split 'spam-use-regex-headers)
+                      (any "ding" "ding")
+                      ;; note that spam by default will go to "spam"
+                      (: spam-split)
+                      ;; default mailbox
+                      "mail"))
+
+;; my parameters, set with `G p'
+
+;; all nnml groups, and all nnimap groups except
+;; "nnimap+mail.lifelogs.com:train" and
+;; "nnimap+mail.lifelogs.com:spam": any spam goes to nnimap training,
+;; because it must have been detected manually
+
+((spam-process-destination . "nnimap+mail.lifelogs.com:train"))
+
+;; all NNTP groups
+;; autodetect spam with the blacklist and ham with the BBDB
+((spam-autodetect-methods spam-use-blacklist spam-use-BBDB)
+;; send all spam to the training group
+ (spam-process-destination . "nnimap+mail.lifelogs.com:train"))
+
+;; only some NNTP groups, where I want to autodetect spam
+((spam-autodetect . t))
+
+;; my nnimap "nnimap+mail.lifelogs.com:spam" group
+
+;; this is a spam group
+((spam-contents gnus-group-spam-classification-spam)
+
+ ;; any spam (which happens when I enter for all unseen messages,
+ ;; because of the gnus-spam-newsgroup-contents setting above), goes to
+ ;; "nnimap+mail.lifelogs.com:train" unless I mark it as ham
+
+ (spam-process-destination "nnimap+mail.lifelogs.com:train")
+
+ ;; any ham goes to my "nnimap+mail.lifelogs.com:mail" folder, but
+ ;; also to my "nnimap+mail.lifelogs.com:trainham" folder for training
+
+ (ham-process-destination "nnimap+mail.lifelogs.com:mail" 
+                          "nnimap+mail.lifelogs.com:trainham")
+ ;; in this group, only '!' marks are ham
+ (ham-marks
+  (gnus-ticked-mark))
+ ;; remembers senders in the blacklist on the way out - this is
+ ;; definitely not needed, it just makes me feel better
+ (spam-process (gnus-group-spam-exit-processor-blacklist)))
+
+;; Later, on the IMAP server I use the "train" group for training
+;; SpamAssassin to recognize spam, and the "trainham" group for
+;; recognizing ham - but Gnus has nothing to do with it.
+
+@end example
+
+@example
+;; from Reiner Steib <4.uce.03.r.s@@nurfuerspam.de>
+* Using `spam.el' on an IMAP server with a statistical filter on the
+  server
+
+** Background
+My provider has set up bogofilter (in combination with DCC) on the
+mail server (IMAP).  Recognized spam goes to "spam.detected", the rest
+goes through the normal filter rules, i.e. to "some.folder" or to
+"INBOX".  Training on false positives or negatives is done by copying
+or moving the article to "training.ham" or "training.spam"
+respectively.  A cron job on the server feeds those to bogofilter with
+the suitable ham or spam options and deletes them from the
+"training.ham" and "training.spam" folders.
+
+** Setup
+
+With the following entries in `gnus-parameters', `spam.el' does most
+of the job for me:
+
+   ("nnimap:spam\\.detected"
+    (gnus-article-sort-functions '(gnus-article-sort-by-chars))
+    (ham-process-destination "nnimap:INBOX" "nnimap:training.ham")
+    (spam-contents gnus-group-spam-classification-spam))
+   ("nnimap:\\(INBOX\\|other-folders\\)"
+    (spam-process-destination . "nnimap:training.spam")
+    (spam-contents gnus-group-spam-classification-ham))
+
+*** The Spam folder:
+
+  In the folder "spam.detected", I have to check for false positives
+  (i.e. legitimate mails, that were wrongly judged as spam by
+  bogofilter or DCC).
+  
+  Because of the `gnus-group-spam-classification-spam' entry, all
+  messages are marked as spam (with `$').  When I find a false
+  positive, I mark the message with some other mark (see `ham-marks'
+  in the manual: `C-h i d gnus RET i ham-mark RET').  On group exit,
+  those messages are copied to both groups, "INBOX" (were I want to
+  have the article) and "training.ham" (for training bogofilter) and
+  deleted from the "spam.detected" folder.
+
+  The sort-by-chars entry simplifies detection of false positives for
+  me.  I receive lots of worms [1] (sweN, ...), that all have a
+  similar size.  Grouping them by size (i.e. chars) makes finding
+  other false positives easier.
+
+*** Ham folders:
+
+  In my ham folders, I just hit `S x' (`gnus-summary-mark-as-spam')
+  whenever I see an unrecognized spam mail (false negative).  On group
+  exit, those messages are moved to "training.ham".
+
+* Reporting spam articles in Gmane [2] groups with `spam-report.el'
+
+With following entry in `gnus-parameters', `S x'
+(`gnus-summary-mark-as-spam') marks articles in gmane.* groups as spam
+and reports the to Gmane at group exit: 
+
+   ("^gmane\\."
+    (spam-process (gnus-group-spam-exit-processor-report-gmane)))
+
+Additionally, I use `(setq spam-report-gmane-use-article-number nil)'
+because I don't read the groups directly from news.gmane.org, but
+through my local news server (leafnode).  I.e. the article numbers are
+not the same as on news.gmane.org, thus `spam-report.el' has to check
+the "X-Report-Spam" header to find the correct number.
+
+[1] Of course worms aren't "spam" (UCE, UBE) strictly speaking.
+    Anyhow, bogofilter is an excellent tool for filtering those
+    unwanted mails for me.
+
+[2] <URL:http://gmane.org/>
+@end example
 
 @node Blacklists and Whitelists
 @subsubsection Blacklists and Whitelists
@@ -23539,9 +23708,9 @@ to @code{spam-list-of-processors}.
 Add
 @example
     (spam-use-blackbox  spam-blackbox-register-routine
-                nil
-                spam-blackbox-unregister-routine
-                nil)
+                 nil
+                 spam-blackbox-unregister-routine
+                 nil)
 @end example
 to @code{spam-registration-functions}.  Write the register/unregister
 routines using the bogofilter register/unregister routines as a
@@ -23594,8 +23763,8 @@ Gnus parameters
 
 Add
 @example
-                  (const :tag "Spam: Blackbox"   (spam spam-use-blackbox))
-                  (const :tag "Ham: Blackbox"    (ham spam-use-blackbox))
+                   (const :tag "Spam: Blackbox"   (spam spam-use-blackbox))
+                   (const :tag "Ham: Blackbox"    (ham spam-use-blackbox))
 @end example
 to the @code{spam-process} group parameter in @code{gnus.el}.  Make
 sure you do it twice, once for the parameter and once for the
@@ -23603,7 +23772,7 @@ variable customization.
 
 Add
 @example
-         (variable-item spam-use-blackbox)
+          (variable-item spam-use-blackbox)
 @end example
 to the @code{spam-autodetect-methods} group parameter in
 @code{gnus.el}.