I edited the script to be able to run it from command line, it parses every
file under $dirname variable 
and save the results (tripped emails) under $path.
I am not a Perl Coder (But a Java One ;) ) so comments are welcome. I made
it available here: 

#!/usr/bin/perl
#


my $path = "Spam/";
use Mail::SpamAssassin::Message;
use Data::UUID;
my $dirname = "MailsSpamToProcess/";


   
opendir(DIR, $dirname) or die "can't opendir $dirname: $!";

while (defined($file = readdir(DIR))) {

        #print $dirname . $file;
        open(INFO, $dirname . $file);           # Open the file
        @message = <INFO>;              # Read it into an array
        #print @message;

my $msg = Mail::SpamAssassin::Message->new(
    {
      'message' => [EMAIL PROTECTED],

    }
) || die "Message error?";
print "@message";

foreach my $p ($msg->find_parts(qr/^message\b/i, 0)) {
    eval {

           #no warnings ;
           my $type = $p->{'type'};
           my $ug = new Data::UUID;
           my $uuid1 = $ug->create_str();
           my $attachname = $path . $uuid1 . ".eml";
           open OUT, ">", "$attachname" || die "Can't write file
$attachname:$!";
           binmode OUT;
           print OUT $p->decode();
    };
}



        close(INFO);
}
closedir(DIR)

I have one more question, before i enable bayes filter on my site, what if
no bayes_path is specified on local.cf? Will it use the default path 
(/root/.spamassassin/) ?

Thanks :) !

>I haven't tested this script by running it manually and this script is
>not written by me. But you can run it manually as it is a script it
>can be run from the command line. I don't know about the parameters
>may be you can pass a fake or unwanted email to this script.


-- 
View this message in context: 
http://www.nabble.com/Thunderbird-Forwarding-Spam-tf2539303.html#a7098708
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.

Reply via email to