Re: [exim] Problems testing (sieve) filter rules

Top Page
Delete this message
Reply to this message
Author: Benjamin Podszun
Date:  
To: exim-users
Subject: Re: [exim] Problems testing (sieve) filter rules
On Thu, 7 Feb 2008, Phil Pennock wrote:
> On 2008-02-07 at 20:32 +0100, Benjamin Podszun wrote:
>> On Thu, 7 Feb 2008, Phil Pennock wrote:
>>> On 2008-02-07 at 19:29 +0100, Benjamin Podszun wrote:
>>>> Okay, two things make me nervous here:
>>>> 1) Why is the recipient in this test the current user? I know that I can
>>>> override/set that with -bfd/-bfl but I expected that exim takes these
>>>> values from the testmail - to test the rules?
>>>
>>> Only if you tell it to. Otherwise the recipients are specified on the
>>> command-line.
>>
>> Would love to tell it to use the sample mail somehow. But since I'm
>> testing filter rules with a sample message, what's the message for if it
>> isn't used for the addresses? Headers only by default? Anything at all?
>> Sorry, I'm still lost here.
>
> Because you can filter based upon properties of the message. Take a
> look at RFC 5228, which is the current specification for Sieve and which
> contains a number of examples.
>
> Eg, you can filter based on the size of the message, content of various
> headers (eg, Subject:), etc. You're not limited to just the envelope.
>
> Eg, extracting from an old sieve file I have (used with Cyrus IMAP, not
> with Exim):
>
> ----------------------------8< cut here >8------------------------------
> if envelope :is "from" "cvs-changes-request@???" {
>  if header :matches "Subject" ["CVS commit: home/pdp *", "CVS commit: home/pdp/*"] {
>    fileinto "INBOX.cvs.mine"; stop;
>  }
>  fileinto "INBOX.cvs.misc"; stop;
> }

>
> if header :is "Content-Type" "text/html" {
> fileinto "INBOX.html-only"; stop;
> }
>
> # implicit keep here
> ----------------------------8< cut here >8------------------------------
>
> So the envelope check uses the values faked up, but the Subject: check
> is using the content.


Okay, got that now. That basically means that I cannot easily test sieve
rules based on the envelope address though, but I can do it manually
somehow. Being naive about this stuff I imagined that I could take X
sample messages from my inbox (which unfortunately differ in envelope to
as well) and run them through the filter, checking if ben@mydomain ends up
in another folder than ben@anotherdomain and it still works with putting
list mails to ben@mydomain in a third folder. Some kind of "fully
automated" test, asking exim "What would happen if this message would
come in right now" without additional info.
I understand your point though and will provide the info per mail,
manually.
Thanks for answering right away.

Ben