chanakya has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use MIME::Parser; use Data::Dumper; parse_email(); sub parse_email { my $dir = "/tmp/attachments"; my $parser = new MIME::Parser; $parser->output_dir($dir); my $entity = $parser->read(\*STDIN) || die "couldn't parse MIME stre +am"; my $head = $entity->head; my $content = $head->as_string . "\n"; my @parts = $entity->parts; my $body = $entity->bodyhandle; $content .= $body->as_string if defined $body; my $part; for $part (@parts) { my $path = ($part->bodyhandle) ? $part->bodyhandle->path : undef; } return $content; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Saving all email attachments into various files.
by brian_d_foy (Abbot) on Jan 09, 2005 at 07:28 UTC | |
by chanakya (Friar) on Jan 09, 2005 at 13:19 UTC | |
|
Re: Saving all email attachments into various files.
by trammell (Priest) on Jan 08, 2005 at 18:25 UTC | |
by chanakya (Friar) on Jan 09, 2005 at 04:59 UTC | |
by trammell (Priest) on Jan 10, 2005 at 02:26 UTC | |
|
Re: Saving all email attachments into various files.
by fuzzyping (Chaplain) on Jan 08, 2005 at 20:46 UTC |