[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: spamassassin w/ evolution?



On Sat, 2002-07-06 at 22:47, Arthur H. Johnson II wrote:
> 
> You can install spamassassing with apt-get install spamassassin.  Set
> /etc/default/spamassassin parameter ENABLED to 1.  Make sure the spamd
> service runs from /etc/init.d/spamassassin Then use the following procmail
> recipe to tag the mail:


You can run spamassassin as a site-wide service direct from exim,
without using procmail.  (I got the following set-up off a web page
whose address I can't now remember.)

In exim.conf:
#                      TRANSPORTS CONFIGURATION 
...
# SpamAssassin - order does not matter
spamcheck:
   driver = pipe
   command = "/usr/local/bin/spamcheck.pl ${sender_address} ${pipe_addresses}"
   prefix =
   suffix =
   check_string =
   escape_string =
   # for debugging change return_output to true
   return_output = false
   return_path_add = false
   user = mail
   group = mail
   path = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
   current_directory = "/tmp" 
...
end
...
#                      DIRECTORS CONFIGURATION   
real_local:
...
# SpamAssassin - must come immediately after real-local (unless
# there is a virus checker in between)
spamcheck_director:
   condition = "${if eq {$received_protocol}{spam-scanned} {0}{1}}"
   driver = smartuser
   transport = spamcheck
...




################# Perl script ############
olly@linda$ sudo cat /usr/local/bin/spamcheck.pl 
Password:
#!/usr/bin/perl
# This is an small wrapper script around Mail::SpamAssassin for the use
# with the exim MTA
# It is released under the Terms of GNU General Public License (GPL) so
# use at your own risk!

use Mail::Audit;
use Mail::SpamAssassin;

$exim     = '/usr/sbin/exim';       #Full path to exim 
$params   = '-oMr spam-scanned -i'; #Additional params no need to change
$savespam = 1;                      #1/0 should spam be saved somewhere?
$spamfile = '/var/spool/spam';      #If you said 1 above - where to put
                                    #that nasty spam? Be sure this mailbox
                                    #is writable by the user who runs this
                                    #script (e.g. mail)

#These are given as command line arguments by exim:
$sender = shift(@ARGV);
$sender = '<>' if $sender eq '';
$recpt = '';
while (@ARGV){
  $recpt = $recpt.' '.shift(@ARGV);
}

####### Main script ###########################################################

$mail = Mail::Audit->new(); #Read Mail from STDIN

$spamtest = Mail::SpamAssassin->new();
$status = $spamtest->check ($mail);

#Add the X-Spam Headers:
$status->rewrite_mail ();

if ($status->is_spam ()) {
  $mail->accept($spamfile) if ($savespam);
  #FIXME include reporting to razor later!
  # -- or maybe not - some real mail gets tagged by spamassassin, so
  # automating a razor report is not a good idea.
} else {
  # $mail->accept();            # to default incoming mailbox
  # Feed the message back to exim:
  $mail->pipe("$exim $params -f $sender $recpt");
}

################# end of Perl script ############



-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: