bobdole has asked for the wisdom of the Perl Monks concerning the following question:
OUTPUT: Num-parts: 2 -- Content-type: multipart/alternative Effective-type: multipart/alternative Body-file: NONE Num-parts: 2 -- Content-type: text/plain Effective-type: text/plain Body-file: this/is/my/path/2006-02-17/msg-32404-1.txt -- Content-type: text/html Effective-type: text/html Body-file: this/is/my/path/saved/2006-02-17/msg-32404-2.html -- Content-type: application/octet-stream Effective-type: application/octet-stream Body-file: this/is/my/path/saved/2006-02-17/-3.pdf Recommended-filename: 01267-TXN-CC-000086475[1].pdf
# create a MIME::Parser object to # extract any attachments found within. my $parser = new MIME::Parser; $parser->output_dir( $savedir ); my $entity = $parser->parse_data($msg); # extract our mime parts and go through each one. my @parts = $entity->parts; foreach my $part (@parts) { # determine the path to the file in question. my $path = ($part->bodyhandle) ? $part->bodyhandle->path : undef +; print "This is the $path \n"; #right here if it doesnt have the + brackets it will give the correct file name if it does it will come +back -1.pdf or some other count
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: file attatchment name
by brian_d_foy (Abbot) on Feb 20, 2006 at 08:18 UTC | |
by bobdole (Beadle) on Feb 20, 2006 at 15:58 UTC | |
|
Re: file attatchment name
by McD (Chaplain) on Feb 20, 2006 at 13:01 UTC | |
by saberworks (Curate) on Feb 20, 2006 at 20:26 UTC |