This can be fairly trivially achieved with Net::POP3 and Email::MIME - the following example is not exhaustive and only partially tested (I didn't have any MIME mail in my mailbox at the time), but should put you in the right direction:
Hope that helps#!/usr/bin/perl use strict; use warnings; use Net::POP3; use Email::MIME; my $pop3server = 'your.server.here'; my $username = 'yourlogin'; my $password = 'yourpassword'; my $popclient = Net::POP3->new( $pop3server, Timeout => 60 ); if ( $popclient->login( $username, $password ) > 0 ) { foreach my $msgnum ( keys %{$popclient->list()} ) { my $msg = $popclient->get($msgnum); my $message = join '', @{$msg}; my $parsed = Email::MIME->new($message); foreach my $part ( $parsed->parts() ) { my $filename = $part->filename(1); open FILE, '>', $filename or do { warn "can't open $filename - $!"; next; }; print FILE $part->body(); close FILE; } $popclient->delete($msgnum); # remove if you want to keep th +e messages } } $popclient->quit();
/J\
In reply to Re: E-Mail Attachment Downloader
by gellyfish
in thread E-Mail Attachment Downloader
by bkiahg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |