Re: [exim] different spam levels on Spam Assassin

Top Page
Delete this message
Reply to this message
Author: Peter Velan
Date:  
To: exim users
Subject: Re: [exim] different spam levels on Spam Assassin
am 30.09.2009 17:23 schrieb Jonathan Gilpin:
> Is it possible to have different users have different spam levels in
> spam assasin when using Exim?
>
> Ie: is it possible to have a director or transport get a value from
> the SQL database and compare this against the spam score? To decide if
> the message should be put in the spam folder or dumped to devnull or
> left alone in the inbox?
>
> I'd like to avoid having lots of different databases and tables... and
> also want users to be able to change their SQL in a webpage...
>
> Can anyone help with this?


The following logic is derived from "vexim"
<http://silverwraith.com/vexim/>:

--- in "acl_check_content":

# Run spamassassin, mark with "X-Spam-Score:" and
# "X-Spam-Report:" headers
#
warn message = X-Spam-Score: $spam_score ($spam_bar)
condition = ${if < {$message_size}{750k} }
spam = 100:true
#
warn message = X-Spam-Report: $spam_report
condition = ${if < {$message_size}{750k} }

--- in router section:

# Compare "$spam_score_int" (= spamassassin's score * 10) against
# value from database. The query depends on receivers domain and
# local_part.
#
# structure of `usertable`:
# --------------+----------------
#  column       |  value example
# --------------+----------------
# `domain`      | 'example.tld'
# `localpart`   | 'username'
# `spamcheck`   | 'yes '
# `refusev`     |  5
#
spam_router:
  driver = accept
  transport = spam_transport
  condition = \
    ${if > \
      {$spam_score_int} \
      {${lookup mysql{ \
        SELECT `refusev` * 10 FROM `usertable` \
        WHERE `domain` = '${quote_mysql:$domain}' \
        AND `localpart` = '${quote_mysql:$local_part}' \
        AND `spamcheck` = 'yes' \
        AND `refusev` > 0 \
      } {$value}fail} } \
    }
  unseen


--- in transport section:

# put spam messages into a quarantine folders
#
spam_transport:
driver = appendfile
envelope_to_add
return_path_add
delivery_date_add
mode = 0600
maildir_format = false
mailstore_format = false
create_directory = true
maildir_use_size_file = false
directory = /path_to_spamquarantine/$domain/$local_part
user = 100
group = 100
debug_print = true


HTH,
Peter