Gnus development mailing list
 help / color / mirror / Atom feed
From: Jonas Steverud <d4jonas@dtek.chalmers.se>
Subject: Re: Splitting and procmail
Date: Wed, 11 Sep 2002 15:29:28 +0200	[thread overview]
Message-ID: <wtn8z28r6x3.fsf@licia.dtek.chalmers.se> (raw)
In-Reply-To: <wtn1y822iiw.fsf@licia.dtek.chalmers.se> (Jonas Steverud's message of "Tue, 10 Sep 2002 13:25:43 +0200")

Jonas Steverud <d4jonas@dtek.chalmers.se> writes:

[...]
> Is it possible to have a split that checks the From and if a certain
> regexp matches, a function is called that tests wheather the sender is a
> member of BBDB and if not it is placed in "Spam", otherwise the next
> rule is tested?

After doing some searches in the archives and the 'Net as such, I've
come up with the following function. I haven't tested it yet, so
comments are more then welcome.

I hope my example in the documentation string is correct.

(defun js-gnus-split-if-not-in-bbdb (SPLIT)
  "If the sender is not within the BBDB, the function returns SPLIT,
i.e. it is split to that group. SPLIT is a `nnmail-split-fancy'
`split' construct - usually a string with a group name.

To use BBDB as a white list for spam:
  nnmail-split-fancy
  ...
    \(|
      ...
       \(any \"\\\\(hotmail\\\\|msn\\\\|aol\\\\|yahoo\\\\|excite\\\\)\\.\\\\(co\\.uk\\\\|com\\\\|org\\\\)\"
                   \(: js-gnus-split-if-not-in-bbdb \"Spam\"\)
           \)
      

Handy togeather with very harsh spam filtering regexp's, like all mail
from Hotmail, MSN, AOL et al. Place valid addresses in BBDB and all
other mails will go to the spam group.

Inspired by http://www.gnus.org/list-archives/ding/200204/msg00077.html.
"
    (let ((from (message-fetch-field "from")))
      (and from
	   (let ((comp (condition-case ()
			   (mail-extract-address-components from)
			 (error nil))))
	     (if (and comp (not (bbdb-search-simple (car comp) (cadr comp))))
		 SPLIT)))))



-- 
(          www.dtek.chalmers.se/~d4jonas/         !     Wei Wu Wei     )
(        Meaning of U2 Lyrics, Roleplaying        !  To Do Without Do  )



  reply	other threads:[~2002-09-11 13:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-08  8:40 Jonas Steverud
2002-09-08 12:33 ` Reiner Steib
2002-09-09  0:14   ` Harry Putnam
2002-09-09  9:30     ` Kai Großjohann
2002-09-09 12:39     ` Reiner Steib
2002-09-09 13:06       ` Kai Großjohann
2002-09-09 13:54         ` Reiner Steib
2002-09-09 14:09           ` Kai Großjohann
2002-09-09 16:39         ` Harry Putnam
2002-09-08 12:44 ` Mark Triggs
2002-09-08 14:31   ` Jonas Steverud
2002-09-09  0:31   ` Harry Putnam
2002-09-09  4:32     ` Mark Triggs
2002-09-09  3:40 ` Scott A Crosby
2002-09-09  9:32   ` Kai Großjohann
2002-09-10 11:25   ` Jonas Steverud
2002-09-11 13:29     ` Jonas Steverud [this message]
2002-09-13 17:51       ` Jonas Steverud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wtn8z28r6x3.fsf@licia.dtek.chalmers.se \
    --to=d4jonas@dtek.chalmers.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).