Re: [Exim] How to write a condition??

Góra strony
Delete this message
Reply to this message
Autor: Glenn Carver
Data:  
Dla: Alexander Prohorenko
CC: exim-users
Temat: Re: [Exim] How to write a condition??
Hi Alexander,

You might find it easier to use a search like this:

@@lsearch;/usr/local/exim/etc/spamtrustedusers

The @@ in front of lsearch is a documented feature. What it does is
split the local_part and domain of the address and use those as keys
in the search. So for instance, if your file had this in it:

hotmail.com    aaa : bbb : ccc


and you did a search on aaa@??? then it would match the
hotmail.com domain and then the 'aaa' user part.

This is how I do my whitelisting. So my spamassassin router looks like this:

spamcheck_router:
senders = ! @@lsearch;/etc/mail/exim/sender_whitelist
no_verify
check_local_user
# this condition should be all one line!!
condition = "${if and { {!def:h_X-Spam-Status:} {!eq
{$received_protocol}{spam-scanned}}} {1}{0} }"
driver = accept
transport = spamcheck


Hope that helps.

Glenn



>Guys,
>
>Can you please help me?
>
>I've got a problem to write a condition.
>
>It looks like this now:
>
>virtual_localuser_spam:
>...
> condition = ${if eq{$h_X-SPAM-Flag:}{YES} {yes}{no}}
>...
>
>And I need it to test also if "$local_part@$domain" does not exist in
>the "/usr/local/exim/etc/spamtrustedusers" file.
>
>I have tried the following:
>
>condition = ${if and {{
>!${lookup{$local_part@$domain}lsearch{/usr/local/exim/etc/spamtrustedusers}}
>} {eq{$h_X-SPAM-Flag:}{YES}}} {yes}{no}}
>
>But it didn't work with some error.
>
>Can you please help?
>
>Cheers,
>--
>Prohorenko