[Exim] Trying to get SpamAssassin to reject mail

Top Page
Delete this message
Reply to this message
Author: Patrick Boutilier
Date:  
To: Exim Users
Subject: [Exim] Trying to get SpamAssassin to reject mail
Exim 4.12 and SpamAssassin 2.50

I am trying to get Exim to reject mail that SpamAssassin determines to
be spam. I use exiscan for virus scanning but I want spam scanning to be
optional and a per user basis. All my users are stored in a MySQL
database. I have the following router and transport working but I can't
think of a way to get either Exim or SpamAssassin to reject the mail
instead of delivering it to the user. Any ideas/thoughts? Thanks.






# Spam Assassin Router
spamcheck_router:
no_verify
# When to scan a message :
# - it isn't already flagged as spam
# - it isn't already scanned
# - if a user wants it to be

condition = "${if and { {!def:h_X-Spam-Flag:} {!eq
{$received_protocol}{spam-scanned}} {eq {1}{${lookup mysql {select
spamassasin from user where userid='${lc:$local_part}'}}}}} {1}{0}}"

driver = accept
transport = spamcheck





# Spam Assassin Transport
spamcheck:
     driver = pipe
     command = /usr/local/exim/bin/exim -oMr spam-scanned -bS
     use_bsmtp = true
     transport_filter = /usr/bin/spamc
     home_directory = "/tmp"
     current_directory = "/tmp"
     # must use a privileged user to set $received_protocol on the way
back in!
     user = mail
     group = mail
     log_output = true
     return_fail_output = true
     return_path_add = false
     message_prefix =
     message_suffix =