stew has asked for the wisdom of the Perl Monks concerning the following question:
(In the real app the print bit in the above loop would probably be used to add parts to MIME::Lite message or similar!)use Mail::Internet; use MIME::Parser; $mail = new Mail::Internet \*STDIN; # Create new parser my $parser = new MIME::Parser; # Keep parsed message bodies in core $parser->output_to_core('ALL'); # Make the Mail::Internet message into an array @lines = (@{$mail->header}, "\n", @{$mail->body}); # Parse an in-core MIME message $parser->parse_data(\@lines); $ent->make_multipart; @parts = $ent->parts; foreach my $i ( 0 .. $#parts ) { print "Part $i ". $parts[$i]->mime_type . "\n\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Carving up MIME email on STDIN
by markov (Scribe) on Dec 03, 2003 at 19:31 UTC | |
|
Re: Carving up MIME email on STDIN
by thatguy (Parson) on Dec 03, 2003 at 19:25 UTC | |
|
Re: Carving up MIME email on STDIN
by waswas-fng (Curate) on Dec 03, 2003 at 23:25 UTC | |
|
Re: Carving up MIME email on STDIN
by stew (Scribe) on Dec 04, 2003 at 10:00 UTC |