Perl module to clear pop mailbox?

A

AcCeSsDeNiEd

Hi folks,

I'm attempting to automatically log into a pop account and clear/delete all the emails in it.
I know I can do this with some telnet routines, but if there is already a module out there, it would
safe me time.

I need this because the pop provider does not use 'standard' forwarding features.
Once an email has been forwarded, there just leave it there and my users have to regularly go in to
clear up their mailboxes.

Thanks

To e-mail, remove the obvious
 
S

Sisyphus

AcCeSsDeNiEd said:
Hi folks,

I'm attempting to automatically log into a pop account and clear/delete all the emails in it.
I know I can do this with some telnet routines, but if there is already a module out there, it would
safe me time.

I need this because the pop provider does not use 'standard' forwarding features.
Once an email has been forwarded, there just leave it there and my users have to regularly go in to
clear up their mailboxes.

Thanks

To e-mail, remove the obvious

I've been using such a module to parse the headers of the mail on my
ISP's server and delete (from the server) the Swen virus emails (so I
don't have to download them to clear the pile).

To delete everything (untested):

use strict;
use warnings;
use Mail::pOP3Client;

my $pop = new Mail::pOP3Client
( USER=> "username",
PASSWORD=> "password",
HOST=> "something_like_mail.host.com",
#AUTH_MODE=> 'PASS', # perhaps not needed - see docs
TIMEOUT => 60,
DEBUG=> 0, # set to 1 to diagnose trouble
) or warn "cannot open: $!";

my $c = $pop->Count();
for (my $i = 1; $i <= $c; $i++) { $pop->Delete($i)}
$pop->Close() or warn "Can't close: $!";
__END__

One (obvious) thing to keep in mind is that if some mail turns up after
the user has performed a download, but before this script starts, then
that user will never see that mail, and no-one will know about it.

I think my preferred approach would be to apply standard forwarding
procedure :)

Cheers,
Rob
 
S

Salvador Fandino

AcCeSsDeNiEd said:
Hi folks,

I'm attempting to automatically log into a pop account and clear/delete all the emails in it.
I know I can do this with some telnet routines, but if there is already a module out there, it would
safe me time.

Hi,

Some days ago I released yaspi, a perl script to remove Swen from POP3
mail accounts. It could be configured to delete everything not just
infected mails, or just modify the source to suit your needs.

http://yaspi.sourceforge.net

Bye,

- Salva
 
A

AcCeSsDeNiEd

This works great Sisyphus!

Thanks.

Btw, regarding your concerns, it's actually ok because this 'third party' pop provider provides
forwarding features but not 'standard' as I have stated earlier. That means after forwarding the
email, they still retain a copy of it (which should be optional). So I will carry on using their
non-standard forwarding feature in conjunction with your script.

I've been using such a module to parse the headers of the mail on my
ISP's server and delete (from the server) the Swen virus emails (so I
don't have to download them to clear the pile).

To delete everything (untested):

use strict;
use warnings;
use Mail::pOP3Client;

my $pop = new Mail::pOP3Client
( USER=> "username",
PASSWORD=> "password",
HOST=> "something_like_mail.host.com",
#AUTH_MODE=> 'PASS', # perhaps not needed - see docs
TIMEOUT => 60,
DEBUG=> 0, # set to 1 to diagnose trouble
) or warn "cannot open: $!";

my $c = $pop->Count();
for (my $i = 1; $i <= $c; $i++) { $pop->Delete($i)}
$pop->Close() or warn "Can't close: $!";
__END__

One (obvious) thing to keep in mind is that if some mail turns up after
the user has performed a download, but before this script starts, then
that user will never see that mail, and no-one will know about it.

I think my preferred approach would be to apply standard forwarding
procedure :)

Cheers,
Rob


To e-mail, remove the obvious
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top