Re: script for zapping Swen at the pop server
Heres my perl script. I also run it in cron.
On Sat, 2003-09-27 at 03:49, Ron Johnson wrote:
> (Mailfilter only checks headers, so can't see filenames of
> attachments.)
>
> I've got this in my crontab:
> */5 * * * * (/home/me/pop_zap_msft.py && fetchmail -s)
>
> The rc (named ~/.pop_zap_msftrc) has this *exact* format:
> SERVER=pop.someisp.net
> USER=snarfle
> PASS=blah
>
> Hope you find it useful....
#!/usr/bin/env perl
use Mail::POP3Client;
$pop=Mail::POP3Client->new(USER=>"username",PASSWORD=>"password",HOST=>"mail.example.com",AUTH_MODE=>"PASS",DEBUG=>$ARGV[0]);
my $delete=0;
print "Count = ".$pop->Count."\n";
for($i=1;$i<=$pop->Count;$i++){
$delete=1;
foreach ($pop->Head($i)){
$delete=0 if /^To.*?linux/i;
print if m/^Subject/i
}
if($delete == 1){
print " DELETED\n";
$pop->Delete($i);
}
}
$pop->Close;
Reply to: