Hi all,

I'm trying to save attachment from emails with a specific subject. but i can't find the right module...

thank you for your help.

My script :

       # Duh
       use Net::IMAP::Simple;
       use Email::Simple;

       # Create the object
       my $imap = Net::IMAP::Simple->new('xxx.xxx.xxx.xxx') ||
die "Unable to connect to IMAP: $Net::IMAP::Simple::errstr\n";

       # Log on
       if(!$imap->login('[EMAIL PROTECTED]','xxxxx')){
               print STDERR "Login failed: " . $imap->errstr . "\n";
               exit(64);
       }
       my $nm = $imap->select('INBOX');

       for(my $i = 1; $i <= $nm; $i++){
my $test_sub = Email::Simple->new(join '', @{ $imap->top($i) } );
               my $subject = substr($test_sub->header('Subject'),0,25);

               if($subject=="xxxxxxxxxxxxxxxxxxxxxxxxx"){
                       my $es = $imap->get($i);

################################################################## # I want to use @{$es} and extract all attachment from it and save them somewhere # ##################################################################
               }
       }

       $imap->quit;


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to