Re: [Exim] I'm missing something! I must be....

Top Page
Delete this message
Reply to this message
Author: Enkidu
Date:  
To: exim-users
Subject: Re: [Exim] I'm missing something! I must be....
On Mon, 4 Aug 2003 10:08:47 +0100 (BST), you wrote:

>On Sun, 3 Aug 2003, Enkidu wrote:
>
>> if
>> #         ${if def:h_X-RBL-Warning: {$h_X-RBL-Warning:}}
>>     h_X-RBL-Warning:       ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
>> then
>>        deliver spamcatcher
>>        logwrite "- XBL marked this as SPAM"
>>        finish
>> endif

>>
>> Exim is 3.36 on Debian Sarge.
>
>3.36 is obsolete. However, this problem is not specific to Exim 3.
>

It may be, but that is the version in Debian Sarge or Testing. I don't
know what is in stable, but Exim 4 doesn't appear until the "unstable"
release of Debian.

>> --------------------------------------------------------------------------------------
>> Error in message_filter file: unrecognized condition word
>> "def:header_reply-to:{$h_reply-to:}{$h_from:}}" near line 17 of filter
>> file
>> --------------------------------------------------------------------------------------
>
>
>> Does def:header not work? Or, more likely, am I missing something
>> obvious?
>
>I don't know how obvious it is, but what you are missing is that the
>syntax of "if" in a filter file is not the same as the syntax of "if" in
>a string expansion.
>

Doh! So the result of a ${if is a string, not a boolean. Rats! Maybe
that's why it's called a "string expansion"! Dammit, it *was* obvious.
>
>The syntax of filter files is defined in the separate document that is
>distributed as doc/filter.txt in the Exim tarball (and is also available
>in other forms). The syntax is
>
> if <condition> then <stuff> endif
>

The documentation I've been reading is the filter specs for Exim 3.36
from the Exim website. It contains a sub-set of the full spec on
string expansions.

>The problem above is that you do not have a valid <condition>. The valid
>conditions are things like
>
> <string1> is <string2>
> or
> <string1> contains <string2>
> or
> <string1> matches <string2>
>
>In each case, the strings can be expanded strings, which is where the
>complication arises. If all you want to do is test for the existence of
>a header, just test for its content being not empty:
>
>  if $h_X-RBL-Warning: is not "" then
>    <whatever>
>  endif

>
>Your string
>
> ${if def:h_X-RBL-Warning: {$h_X-RBL-Warning:}}
>
>Is in fact exactly the same as $h__X-RBL-Warning:, namely, the value of
>the header if it exists, or nothing if not. However, if you use your
>string, you need to put it in quotes, because it contains spaces.
>
>  if "${if def:h_X-RBL-Warning: {$h_X-RBL-Warning:}}" is not "" then
>    <whatever>
>  endif

>
>I hope this makes things more clear.
>

Yep, thanks.

I've been trying
if $headers contains "$h_X-RBL-Warning" then.... based on something I
saw in someone's filter file.

I'm sorry for the dumb question...

Cheers,

Cliff
--

Signed and sealed with Great Seal of the Executive
Council of the Internet, by The Master of The Net.