[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: simple mail splitting: matching two different headers
From: |
Michael Slass |
Subject: |
Re: simple mail splitting: matching two different headers |
Date: |
Sat, 11 Sep 2004 08:08:44 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Albert Reiner <areiner@tph.tuwien.ac.at> writes:
>Hi,
>
>I want to split all the mail to and from concerning address foo@bar
>according to the presence of some tag in the subject. So, e.g.,
>
> From: foo@bar
> Subject: Re: BAZ ... should go to mail.foo-bar.baz, and
>
> Cc: foo@bar
> Subject: QUUX ... to mail.foo-bar.quux, and
>
> To: foo@bar
> Subject: ... to mail.foo-bar.
>
>From the info file it seems I need to replace the usual regular
>expressions with elisp functions like
>
> (lambda (headers)
> (and (??? "^\\(To\\|From\\|Cc\\): .*foo@bar")
> (??? "^Subject: .* BAZ")))
>
>where (??? regexp) returns true if regexp matches headers, just that I
>don't know what to use for ???. I'm sure this must be exceedingly
>simple for those who know elisp.
>
>Thanks in advance,
>
>Albert.
nnmail-split-fancy was designed to solve just this problem
(setq nnmail-split-methods 'nnmail-split-fancy)
(setq nnmail-split-fancy
'(|
("from\\|b?cc" "foo@bar" ; match from, cc, bcc
(|
( "subject" "BAZ" "mail.foo-bar.baz")
( "subject" "QUUX" "mail.foo-bar.quux" )
"mail.foo-bar"))
;; more splits here
;; ...
;; The last entry is the catch-all group for mails
;; which haven't matched any other rules
"mail.everything.else"
))
--
Mike Slass