Fernando Serto wrote:
> Hey guys,
> 
> I have an e-mail account (spam-quarantine), which receives ALL messages
> marked as spam, the problem is that the person responsible for checking for
> false positives is away, and the amount of messages is huge!
> 
> I'm going through most of them to check for FPs, but I got to a point where
> it would be very nice to trash messages with a score over, let's say 10.

What does your X-Spam-Score header look like?

Mine looks like "X-Spam-Score: 7.3 (+++++++)"

You can use a bit of perl like this:

#! /usr/bin/perl

opendir(DIR, ".");
my @files = grep /^[^.]/, readdir(DIR);
closedir(DIR);

foreach my $file (@files) {
        my $score = 0;
        open (FILE, "<$file");
        while (<FILE>) {
                chomp;
                last if (/^$/);
                if (/^X-Spam-Score: /) {
                        $score = (split)[1];
                        last;   
                }
                elsif (/^X-Spam-Level: /) {
                        $score = length((split)[1]);
                        last;   
                }
        }
        close(FILE);
        next if ($score < 10);

        rename($file, "./temp/$file");
        # OR
        # unlink($file);
} 


Make a directory "temp" in your quarantine directory.  Run this
program with your quarantine directory as the current path.  It
should move all files with a score >= 10.  Test that it does the
rght thing before you delete the temp directory.

Ian

--
Ian Freislich

Reply via email to