Perl module to clear pop mailbox?

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.

Advertisements

AcCeSsDeNiEd wrote:
> 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).

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

AcCeSsDeNiEd wrote:
> 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.

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.

On Tue, 07 Oct 2003 13:53:27 +1000, Sisyphus <> wrote:
>AcCeSsDeNiEd wrote:
>> 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:OP3Client;
>
>my $pop = new Mail:OP3Client
>( 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

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!