Delete pop mail with a perl script

Mar 12, '02 10:14:41PM

Contributed by: hagbard

I tried every shareware that's supposed to let you delete all your mail without downloading them first, but none worked with OS X.

Here's a very simple perl script that does just this. Be warned, though, that it deletes EVERYTHING without giving you any chance to cancel the process...

You will need the Net module available at CPAN (use these commands: perldoc perlmodinstall and perldoc Net::pop3)

#!/usr/bin/perl

use Net::POP3;
 $pop = Net::POP3->new('my.pop3.server');
 $tot = $pop->login('user','login');
 printf("$tot messagesn");
 for($i = 0; $i<$tot; $i++){
  $pop->delete($i);
 }
 $pop->quit();

Comments (0)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020312221441153