On Tue, 1 Jul 2008, Sascha Schmidt wrote:
>
> I thought about a mysql-clause which is used within the condition part.
> The problem I have is that I'm not knowing the correct syntax to create
> the part correctly; missing curely brackets etc... :-)
>
> My first thought was the following one:
> ---
> warn message = X-Spam-Flag: YES
> spam = vmail:true
> condition = ${if >{$spam_score_int}{${lookup mysql{select \
> users.sa_tag * 10 from users,domains \
> where localpart = '${quote_mysql:$local_part}' \
> and domain = '${quote_mysql:$domain}' \
> and users.on_spamassassin = '1' \
> and users.domain_id=domains.domain_id}
> ---
>
> Perhaps someone can look at this code and tell me what's wrong with it.
> Any hint is welcome;)
The problem is that $local_part and $domain are only defined in the RCPT
ACL. A message may have multiple recipients so there's no simple way to
use per-recipient settings in the post-DATA ACL.
What you can do is look up each recipient's setting in a RCPT ACL and
store it in an $acl_mXXXX variable, with some logic to combine multiple
recipients' choices. For example, if you set the variable to 1 if a user
wants messages tagged and do nothing otherwise, then the message will be
tagged if any one of multiple recipients wants it tagged.
# in the RCPT ACL
warn
condition = ${lookup mysql \
{ select users.sa_tag * 10 from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.on_spamassassin = '1' \
and users.domain_id=domains.domain_id \
} {1} {0} }
set acl_mTAG = 1
# in the DATA ACL
warn
condition = $acl_mTAG
spam = vmail:true
add_header = X-Spam-Flag: YES
Tony.
--
<fanf@???> <dot@???>
http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}