[Top][All Lists]

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

Re: w3 under development or not?

From: Peter Lee
Subject: Re: w3 under development or not?
Date: Fri, 14 Nov 2003 15:30:15 GMT
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (windows-nt)

>>>> Shane  writes:

    Shane> I know this is slightly off-topic, but I have the same
    Shane> problem when I download my email under GNUs. It hangs for a
    Shane> long time while 50 of the latest "Microsoft Internet
    Shane> Security patches" or other crap are retrieved. During this
    Shane> wait, I would prefer to be working in a another Emacs
    Shane> window, but Emacs won't accept any input.

I was getting about 50-80 of those a day myself for a while... I wrote
a perl script to parse a .spam file containing one regex per line.  If
any of the regexes in the .spam file match the author or subject in
the mail on the server, it's deleted on the server.  I mainly just
focused on the service packs as they took so long to download.  I'm a
perl novice, so I'm sure this code could be reduced to about 10 lines
by someone that knows the language better.

Here's a snippet from my .spam:


And the script (I called I just call with no arg for
preview: 'perl', and 'perl delete' when I'm
certain of my regexes.

use strict;
use Mail::POP3Client;

open SPAM, "<.spam"
    or die "Failed to open .spam: $!";

my ($parm) = @ARGV;

my @spam = <SPAM>;
chomp @spam;

my $pop = new Mail::POP3Client(USER      => "yourusername",               
                               PASSWORD  => "yourpasswd",            
                               HOST      => "your.pop3.server",
                               AUTH_MODE => 'PASS',
                               TIMEOUT   => 30,
                               LOCALADDR => undef,
                               DEBUG     => 0);

for (my $i = 1; $i <= $pop->Count(); $i++) 
    my @lines = $pop->Head($i);
    my $subj;
    my $from;

    foreach my $ln (@lines)
        if ($ln =~ /^From:/i)
            $from = $ln;
        elsif ($ln =~ /^Subject:/i)
            $subj = $ln;
    my ($msg, $size) = split ' ', $pop->List($i);
    my $deleted = 0;

    print "($msg) $size bytes\n";
    print $from, "\n";
    print $subj, "\n";

    foreach my $s (@spam)
        if ($from =~ /$s/i)
            print "-DELETE FROM ($s)\n";
            if ($parm =~ /delete/i)
                $pop->Delete( $i );
                $deleted = 1;
        elsif ($subj =~ /$s/i)
            print "-DELETE SUBJECT ($s)\n";
            if ($parm =~ /delete/i)
                $pop->Delete( $i );
                $deleted = 1;
    if ($deleted == 0)
        print "-OK\n";

    print "\n";

close SPAM;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]