$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(); #<<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' => " # } } $pop->Reset(); $pop->Close();