#---set mail credentials---# my $_MAILHOST="xxxxx"; my $_USER="xxxx"; #username my $_PASS="xxxx"; #password #---Define output directory---# my $_OUTDIR="/x/xxx/mail/xxx"; #Output attachments here #---Begin retrieve mail and strip attachment---# my $i = 0; my $parser = new MIME::Parser; my $pop = new Mail::POP3Client( HOST =>$_MAILHOST, USER =>$_USER, PASSWORD =>$_PASS, DEBUG =>2, SOCKET => undef, USESSL => 1 ); $parser->output_dir( $_OUTDIR ); if( $pop->Count() < 0 ) { die "Error accessing POP mailbox"; } for( $i = 0; $i <= $pop->Count(); $i++ ) { my $wholeBody = $pop->HeadAndBody( $i ); ### Automatically attempt to RFC 2047-decode the MIME headers? $parser->decode_headers(0); ### default is false ### Look for uuencode in "text" messages, and extract it? $parser->extract_uuencode(0); ### default is false my $entity = $parser->parse_data( $wholeBody ); #$pop->Delete( $i ); }