pdxperl has asked for the wisdom of the Perl Monks concerning the following question:
$pop = new Mail::POP3Client( USER => $USER, PASSWORD => $PW, HOST => $SERVER, USESSL => 'true', # DEBUG => 1, PORT => 995 ); print "Status: ". $pop->State()." unread emails:". $pop->Count()."\n"; $count=$pop->Count(); #<<<set to zero after download if($count < 0 ){ print "Error: Gmail returned ".$pop->Message()."\n"; exit; } elsif ($count == 0){ print "No messages for $USER\n"; exit; } for( $i = 1; $i <= $count; $i++ ) { foreach( $pop->Head( $i ) ) { /^(From|Subject):\s+/i && print $_, "\n"; } $body=$pop->HeadAndBody($i); $stripper=Email::MIME::Attachment::Stripper->new($body); $msg=$stripper->message; @attachments=$stripper->attachments; foreach $attachment (@attachments){ # print "$#attachments found\n"; # add code to save attachments here # structure # $attachments[$i] # 0 HASH # 'content_type' => 'text/xml' # 'filename' => 'foo.xml' # 'payload' => "<attachment> # } } $pop->Reset(); $pop->Close();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Gmail message count reset
by Anonymous Monk on Mar 26, 2009 at 06:28 UTC | |
|
Re: Gmail message count reset
by Anonymous Monk on Apr 30, 2009 at 05:53 UTC | |
by Anonymous Monk on Apr 30, 2009 at 06:16 UTC |