Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Spam Package help
@ 2007-05-21 11:31 Peter Russell
  2007-07-06 16:53 ` Ted Zlatanov
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Russell @ 2007-05-21 11:31 UTC (permalink / raw)
  To: info-gnus-english


Hello again,

Well my migration to Gnus seems to be going well.  I've got a few more
issues to sort out before it's a complete success.

The most important is getting spam filtering working satisfactorily.

I am trying to use the bogofilter back end of the spam package, along
with a bbdb-whitelist (a brilliant idea), and regex headers to catch
things marked as spam upstream (not a lot is marked, but there's
been no false positives, so I guess I might as well)

I receive email to that has been sent to several different email
addresses, some more public than others, and which have different
levels of importance.  For example:

- support requests must receive answers, so I must be very careful not
  to lose ham in my spam.
- email sent to my personal address is probably not as important,
  unless it's from a client - in which case the BBDB white list will
  get it. this address gets a *lot* of spam.

There are two things I'd like to achieve:

1. Since these addresses have different profiles, I'd like to use
   different bogofilter databases for them.  However as far as I can
   see there is only one global setting for the database file.  Is
   this possible - if it isn't now, it worth adding?
2. Since I need to check support request spam (for example) more often
   and more carefully than main INBOX spam, I want to set up some
   specific spam folders, which are linked to their parent folders.  I
   have this almost working.

For number 2, the tree and rules should be something like this:

INBOX                       <- All mail is delivered here
INBOX.spam                  <- The default place to drop spam.
                               Checked infrequently 
INBOX.Support Requests      <- some mail is split here
INBOX.Support Requests.spam <- Spam to the support requests addr. goes
                               here. Checked often.
INBOX.Lists...              <- Spam that would otherwise be split to
                               other folders should go to INBOX.spam

(I hope the formatting of that comes out OK, message mode seems to
handle indenting text very nicely :-) )

What I currently have in my gnus.el is this:

;; We want spam checking!
(spam-initialize)
(setq spam-use-bbdb t
      spam-use-regex-headers t
      spam-use-bogofilter t)

;; This doesn't work!  What I hoped it would do is to say "If a folder
;; doesn't end in .spam then it's a ham folder, and any spam in it
;; should be moved to the same folder name, but with .spam appended.
;; If it does end in .spam, it's a spam folder, and any ham should be
;; moved to the folder with the same name, but without the .spam.  Not
;; exactly what I describe above, but close enough.  As it is, I don't
;; believe it's doing anything at all.  I have no idea how to debug
;; this.
(setq gnus-parameters
      '(("^\\(nnimap\\+mail.qustom.co.uk:INBOX.*\\)$"
         (spam-contents . gnus-group-spam-classification-ham)
         (spam-process-destination . "\\1.spam")
      '(("^\\(nnimap\\+mail.qustom.co.uk:INBOX.*\\)\\.spam$"
         (spam-contents . gnus-group-spam-classification-spam)
         (ham-process-destination . "\\1")

;; message splitting - shortened and for demonstration.  This does
;; work.
(setq nnimap-split-inbox '("INBOX")
      nnimap-split-download-body t
      nnimap-split-rule 'nnimap-split-fancy
      nnimap-split-fancy '(| (any "supportaddress" ;; not the real address
                                  (| (: spam-split
                                        "INBOX.Support Requests.spam")
                                     "INBOX.Support Requests"))
                             (| (: spam-split "INBOX.spam")
                                "INBOX")))

Sorry this post is so long, I didn't have time to make it shorter :-)

Any help would be greatly appreciated.

-- 
Peter Russell <peter.russell@qustom.co.uk>
Qustom

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Spam Package help
  2007-05-21 11:31 Spam Package help Peter Russell
@ 2007-07-06 16:53 ` Ted Zlatanov
  0 siblings, 0 replies; 2+ messages in thread
From: Ted Zlatanov @ 2007-07-06 16:53 UTC (permalink / raw)
  To: info-gnus-english; +Cc: Peter Russell, Ding Mailing List

On Mon, 21 May 2007 11:31:56 GMT Peter Russell <peter.russell@qustom.co.uk> wrote: 

PR> There are two things I'd like to achieve:

PR> 1. Since these addresses have different profiles, I'd like to use
PR>    different bogofilter databases for them.  However as far as I can
PR>    see there is only one global setting for the database file.  Is
PR>    this possible - if it isn't now, it worth adding?

Hi Peter,

sorry for the late reply.  I cc-ed your e-mail address to make sure
you'd get it.

You can put any Lisp code in the (: ) rule, so you could redefine
spam-bogofilter-database-directory temporarily.  Something like this

(let ((spam-bogofilter-database-directory "hello"))
  (message spam-bogofilter-database-directory))

(message spam-bogofilter-database-directory)

Use C-x C-e after the last parenthesis of these two expressions.  The
first one temporarily sets spam-bogofilter-database-directory to
"hello".  So, we can do a rule like this:

(: let ((spam-bogofilter-database-directory "your favorite setting"))
     (spam-split "INBOX.Support Requests.spam"))

This is untested, but it should work (I am CC-ing the Gnus developer
list in case someone has a better suggestion).  You could always write
your own function that wraps spam-split, if you don't like the solution
above.

PR> 2. Since I need to check support request spam (for example) more often
PR>    and more carefully than main INBOX spam, I want to set up some
PR>    specific spam folders, which are linked to their parent folders.  I
PR>    have this almost working.

PR> For number 2, the tree and rules should be something like this:

PR> INBOX                       <- All mail is delivered here
PR> INBOX.spam                  <- The default place to drop spam.
PR>                                Checked infrequently 
PR> INBOX.Support Requests      <- some mail is split here
PR> INBOX.Support Requests.spam <- Spam to the support requests addr. goes
PR>                                here. Checked often.
PR> INBOX.Lists...              <- Spam that would otherwise be split to
PR>                                other folders should go to INBOX.spam

PR> (I hope the formatting of that comes out OK, message mode seems to
PR> handle indenting text very nicely :-) )

PR> What I currently have in my gnus.el is this:

PR> ;; We want spam checking!
PR> (spam-initialize)
PR> (setq spam-use-bbdb t
PR>       spam-use-regex-headers t
PR>       spam-use-bogofilter t)

PR> ;; This doesn't work!  What I hoped it would do is to say "If a folder
PR> ;; doesn't end in .spam then it's a ham folder, and any spam in it
PR> ;; should be moved to the same folder name, but with .spam appended.
PR> ;; If it does end in .spam, it's a spam folder, and any ham should be
PR> ;; moved to the folder with the same name, but without the .spam.  Not
PR> ;; exactly what I describe above, but close enough.  As it is, I don't
PR> ;; believe it's doing anything at all.  I have no idea how to debug
PR> ;; this.
PR> (setq gnus-parameters
PR>       '(("^\\(nnimap\\+mail.qustom.co.uk:INBOX.*\\)$"
PR>          (spam-contents . gnus-group-spam-classification-ham)
PR>          (spam-process-destination . "\\1.spam")
PR>       '(("^\\(nnimap\\+mail.qustom.co.uk:INBOX.*\\)\\.spam$"
PR>          (spam-contents . gnus-group-spam-classification-spam)
PR>          (ham-process-destination . "\\1")

You can debug the rules with (gnus-parameter-spam-contents "GROUP").

For instance, your rules would probably return
'gnus-group-spam-classification-spam for this call:

(gnus-parameter-spam-contents "nnimap+mail.qustom.co.uk:INBOX.*.spam")

I personally find it easier to a) make a group a spam group when the
name contains the string "spam", and b) use topics and topic/group
parameters to set parameters as needed.  Your way should work, but it
seems harder to me :)

Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-06 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-21 11:31 Spam Package help Peter Russell
2007-07-06 16:53 ` Ted Zlatanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).