casimo has asked for the wisdom of the Perl Monks concerning the following question:
use Mail::POP3Client; use Email::MIME; use Email::MIME::Attachment::Stripper; my $pop = new Mail::POP3Client( USER => 'user', PASSWORD => "password", HOST => "pop.gmail.com", USESSL => 'true', ); print "Status: ". $pop->State()." No of email:". $pop->Count(); if ($pop->Count()) { my $mail=$pop->HeadAndBody(1); my $parsed = Email::MIME->new($mail); my $stripper = Email::MIME::Attachment::Stripper->new($parsed); my @attachments = $stripper->attachments; foreach my $att ( @attachments ) { open (FILE, ">>" . $att->{filename}); print FILE $att->{payload}; close (FILE); } } $pop->Close(); exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Downloading Gmail attachments - Corrupted saved file
by ikegami (Patriarch) on Dec 30, 2009 at 22:53 UTC | |
by casimo (Sexton) on Dec 30, 2009 at 23:52 UTC | |
by almut (Canon) on Dec 31, 2009 at 00:01 UTC | |
by casimo (Sexton) on Dec 31, 2009 at 00:22 UTC | |
|
Re: Downloading Gmail attachments - Corrupted saved file
by localshop (Monk) on May 13, 2013 at 23:15 UTC |