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

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Enkidu
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] I'm missing something! I must be....
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.

> --------------------------------------------------------------------------------------
> 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.

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 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.

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book