User Tools

Site Tools


spamassassin:stopping_spam

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
spamassassin:stopping_spam [2016/11/02 00:09] peterspamassassin:stopping_spam [2019/12/04 21:15] (current) – removed peter
Line 1: Line 1:
-====== SpamAssassin - Stopping Spam ====== 
  
-===== Install Mail::Audit ===== 
- 
-SpamAssassin needs the **Mail::Audit** module for Perl. Install Mail::Audit (via CPAN) 
- 
-<code bash> 
-#perl -MCPAN -e shell 
-cpan> install Mail::Audit 
-cpan> quit 
-</code> 
- 
- 
-===== Install Spam Assassin Modules ===== 
- 
-Install SpamAssassin from CPAN, which will also install all other required modules too. 
- 
-<code bash> 
-# perl -MCPAN -e shell 
-cpan> install Mail::SpamAssassin 
-</code> 
- 
-It maybe will ask you for some needed modules that aren't installed yet - Answer yes and Perl will fetch and install them, too. 
- 
-<code perl> 
-cpan> quit 
-</code> 
- 
- 
- 
-===== Run the recommended tests ===== 
- 
-First look if the install succeded by running: 
- 
-<code bash> 
-# which spamassassin 
-/usr/local/bin/spamassassin 
-</code> 
- 
-If you don't get a right answer something failed... or your PATH-variable isn't set right... 
- 
-Now lets scan a no spam mail with 
- 
-<code bash> 
-# spamassassin -t <sample-nonspam.txt |less 
-</code> 
- 
-Look for a line like this in the output: 
- 
-<code> 
-X-Spam-Status: No, hits=0 required=5 tests= 
-</code> 
- 
-Okay fine - now try a bad spam message: 
- 
-<code bash> 
-# spamassassin -t <sample-spam.txt |less 
-</code> 
- 
-which should produce some lines like that: 
- 
-<code> 
-X-Spam-Status: Yes, hits=12 required=5 tests=NO_REAL_NAME,UNDISC_RECIPS,INVALID_DATE,MSGID_HAS_NO_AT,REMOVE_SUBJ,RCVD_IN_OSIRUSOFT_COM 
-X-Spam-Flag: YES 
-</code> 
- 
-Okay everything seems working... that was the easy part :-)  
- 
- 
- 
- 
- 
-<code perl> 
-#!/usr/bin/perl 
-# This is an small wrapper script around Mail::SpamAssassin for the use 
-# with the exim MTA. 
-# Modified to eliminate the buggy Mail::Audit use. 
-# This modification also eliminates the need to re-submit the message 
-# to Exim for delivery to the mail spool. Requires localuser director 
-# to use the spamcheck transport so it knows where to append to. 
-# It is released under the Terms of GNU General Public License (GPL) so 
-# use at your own risk! 
- 
-use Mail::SpamAssassin; 
-use Mail::SpamAssassin::NoMailAudit; 
- 
-$savespam = 1;                      #1/0 should spam be saved centrally? 
-$spamfile = '/var/mail/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::SpamAssassin::NoMailAudit->new(); 
- 
-$spamtest = Mail::SpamAssassin->new(); 
-$status = $spamtest->check ($mail); 
- 
-#Add the X-Spam Headers: 
-$status->rewrite_mail (); 
-#Auto Report to Vipul's Razor: 
-$status->handle_auto_report (); 
- 
-if ($status->is_spam ()) { 
-  if ($savespam) { 
-    $mail->accept($spamfile); # Deliver to spamfile 
-  } else { 
-    $mail->accept();          # Deliver to user's mailbox 
-  } 
-} else { 
-  $mail->accept();            # to default incoming mailbox 
-} 
-</code> 
- 
- 
- 
-===== References ===== 
- 
-http://web.archive.org/web/20041116091629/http://bogmog.sourceforge.net/document_show.php3?doc_id=28 
- 
-http://web.archive.org/web/20041025034458/http://www.sbicomputing.com/scripts/spamcheck.pl 
spamassassin/stopping_spam.1478045356.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki