Re: script for zapping Swen at the pop server
Another possibility is this:
#!/usr/bin/perl
use Mail::POP3Client;
$pop3user="your-user-name";
$pop3pass="your-mail-password";
$pop3host="your-ISP's-POP3-server";
$pop = new Mail::POP3Client( USER => $pop3user,
PASSWORD => $pop3pass,
HOST => $pop3host );
$nswens=0;
for( $i = 1; $i <= $pop->Count(); $i++ ) {
($msgnum, $size) = split ' ', $pop->List($i);
print "msg nr ", $msgnum, "msg size", $size;
if ($size > 147100 && $size < 147800 ||
$size > 159500 && $size < 160500){
$pop->Delete ($i);
print " DELETED!";
$nswens++;
}
print "\n";
}
print $nswens, " swens deleted \n";
$pop->Close();
I just run this automatically each time before fetchmail is run,
redirecting the output to a log file. I don't get that many Swens
so there is no danger of the POP mailbox filling up.
The Mail::POP3Client module is in the libmail-pop3client-perl package.
Regards, Jan
Reply to: