Perl module to clear pop mailbox?

Discussion in 'Perl Misc' started by AcCeSsDeNiEd, Oct 7, 2003.

  1. AcCeSsDeNiEd

    AcCeSsDeNiEd Guest

    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
     
    AcCeSsDeNiEd, Oct 7, 2003
    #1
    1. Advertising

  2. AcCeSsDeNiEd

    Sisyphus Guest

    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::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 reply by email u have to take out the u in kalinaubears.
     
    Sisyphus, Oct 7, 2003
    #2
    1. Advertising

  3. AcCeSsDeNiEd <> wrote:


    > I'm attempting to automatically log into a pop account and
    > clear/delete all the emails in it.



    use Mail::pOP3Client;

    http://search.cpan.org/~sdowd/Mail-POP3Client-2.14/


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Oct 7, 2003
    #3
  4. 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.

    http://yaspi.sourceforge.net

    Bye,

    - Salva
     
    Salvador Fandino, Oct 7, 2003
    #4
  5. AcCeSsDeNiEd

    AcCeSsDeNiEd Guest

    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.

    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::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
     
    AcCeSsDeNiEd, Oct 8, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nirnimesh
    Replies:
    2
    Views:
    330
    Rob Williscroft
    Sep 21, 2006
  2. Replies:
    3
    Views:
    555
    Tim Mackey
    Jan 30, 2007
  3. Replies:
    0
    Views:
    359
  4. ra9ftm

    mailbox module

    ra9ftm, Aug 26, 2008, in forum: Python
    Replies:
    1
    Views:
    323
    ra9ftm
    Aug 26, 2008
  5. Eduardo Alvarez

    mailbox module difficulties

    Eduardo Alvarez, Nov 28, 2011, in forum: Python
    Replies:
    3
    Views:
    161
    Eduardo Alvarez
    Nov 28, 2011
Loading...

Share This Page