Re: [Exim] Exim and Sieve rules

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Tor Slettnes
Date:  
À: Michael Haardt
CC: Exim Users
Sujet: Re: [Exim] Exim and Sieve rules
On May 6, 2004, at 17:07, Michael Haardt wrote:

>> A very simple example is ":matches".  The statement:
>>      if :header :matches "X-Spam-Status" "Yes*"
>>         { fileinto "INBOX.Junk"; }
>> does not work in Exim sieve filters.  I had to use ":contains"
>> instead.

>
> The filter
>   if header :matches "X-Spam-Status" "Yes*"
>      { fileinto "INBOX.Junk"; }
> works as expected here.  Please send me a test message that reproduces
> the problem.  If there is a bug, I shall fix it.


Sorry, there were _two_ typos.
- ":header" should be "header", as you pointed out
- "Yes*" should be "Yes.*"

The last one is the key one. I tried:

    if header :matches "X-Spam-Status" "Yes.*"
        { fileinto "INBOX.Junk"; }
    else
        { keep; }


Everything went into Inbox. However, this works:

    if header :matches "X-Spam-Status" "Yes*"
        { fileinto "INBOX.Junk"; }
    else
        { keep; }


The problem is that the regular expression "Yes*" matches "Ye" followed
by 0 or more "s"s. So, case sensitivity aside, if the following line
was in the mail:

     X-Spam-Status: No (score=1.2): LINES_OF_YELLING=1.2
                                             ^^


the message would incorrectly be dumped into the Junk folder.


Using Cyrus sieve filters, the line:
     if header :matches "X-Spam-Status" "Yes.*"


works as expected.


This is on a friend's machine, running Exim 4.20.

-tor