Re: [Exim] Using SA (Spam Assassin) selectively with Exim

Etusivu
Poista viesti
Vastaa
Lähettäjä: Greg Ward
Päiväys:  
Vastaanottaja: exim-users
Kopio: Odhiambo G. Washington
Aihe: Re: [Exim] Using SA (Spam Assassin) selectively with Exim
On 24 June 2002, Odhiambo G. Washington said:
> May I pose this to those already using SA with Exim.
> Is it possible to use SA with Exim but not globally?
> I want to make a kind of a list that people signup to.
> I then want to make SA _only_ scan mail addressed to users
> appearing on this list..something like a condition on the
> director..


Yes -- here's how I do this. Define this router:

# Mail for any local-part listed in /etc/exim/spamcheck_users is
# piped through my routespam script, which uses SpamAssassin to
# assess spamminess and routes messages accordingly.
spamcheck:
driver = accept
transport = spamcheck
local_parts = lsearch;/etc/exim/spamcheck_users

  # Translated, this reads:
  #   if !(defined X-Spam-Flag) and
  #      !($received_protocol eq "spamc") and
  #      !($received_protocol ne "local") and
  #      !($sender_host_address ne 127.0.0.1) then:
  #      run this director
  condition = "\
    ${if and { {!def:h_X-Spam-Flag:} \
               {!eq {$received_protocol}{spamc}} \
               {!eq {$received_protocol}{local}} \
               {!eq {$sender_host_address}{127.0.0.1}} } \
         {1}{0}}"


# No point sending mail back to the spammer, or a legit sender,
# if my routespam script dies.
errors_to = postmaster
retry_use_local_part

user = ${lookup{$local_part} lsearch {/etc/exim/spamcheck_users} {$value}}
group = mail

The corresponding transport:

spamcheck:
driver = pipe
command = "/etc/exim/routespam $sender_address $local_part@$domain"
delivery_date_add
envelope_to_add
log_output
path = "/usr/bin:/usr/sbin:/bin:/usr/local/bin"
return_output
return_path_add

And the routespam script can be found here:
http://satools.sourceforge.net

        Greg
--
Greg Ward - software developer                gward@???
MEMS Exchange                            http://www.mems-exchange.org