> man, 06,.02.2006 kl. 19.47 +0100, skrev Adrian:
>
>> Is there a way to use it at least for messages with only a single
>> recipient? Or how else can I allow users to use custom spam
>> thresholds (I have a database table which contains the user who
>> owns an email address and a table where the spam thresholds for the
>> users are stored).
Stian Jordet wrote:
>
> You have to use $recipients, and make sure every mail only has one
> recipient (by using similar tricks to
>
> http://duncanthrax.net/exiscan-acl/exiscan-acl-examples.txt
A better solution would be to lookup the recipient's threshold in the
RCPT acl, and store it in an acl_mN variable. For subsequent
recipients, if the acl_mN variable is already set, defer if the new
recipient has a different threshold than what's already set.
So, something like this:
acl_check_rcpt:
# acl_m1 is a scratch var used only locally
require set acl_m1 = ${lookup pgsql { SELECT * FROM
flagSpam('${quote_pgsql:$local_part}@${quote_pgsql:$original_domain}')}}
defer
message = threshold mismatch
condition = ${if and{{def:acl_m2}{!={$acl_m1}{$acl_m2}}}}
# acl_m2 is the threshold for all accepted recipients of the message
require set acl_m2 = $acl_m1
acl_check_data:
warn message = X-Spam-Flag: YES
condition = ${if <{$message_size}{80k}{1}{0}}
spam = nobody
condition = ${if >{$spam_score_int}{$acl_m2}}
- Marc