M
matthewlenz
#!/usr/bin/perl
use MIME:
arser;
use Data:
umper qw(Dumper);
$parser = MIME:
arser->new( );
$parser->output_to_core(1); # don't write attachments to disk
while (<STDIN>) {
$MESSAGE .= $_;
}
$message = $parser->parse_data($MESSAGE); # die( )s if can't parse
$head = $message->head( ); # object--see docs
$preamble = $message->preamble; # ref to array of lines
$epilogue = $message->epilogue; # ref to array of lines
$num_parts = $message->parts;
for (my $i=0; $i < $num_parts; $i++) {
print "part number = $i\n";
my $part = $message->parts(1);
my $content_type = $part->mime_type;
my $body = $part->as_string;
print $body;
}
.......................
When I print the body I get the content headers as well. Is there a
way to just get the actual content?
-Matt
use MIME:
use Data:
$parser = MIME:
$parser->output_to_core(1); # don't write attachments to disk
while (<STDIN>) {
$MESSAGE .= $_;
}
$message = $parser->parse_data($MESSAGE); # die( )s if can't parse
$head = $message->head( ); # object--see docs
$preamble = $message->preamble; # ref to array of lines
$epilogue = $message->epilogue; # ref to array of lines
$num_parts = $message->parts;
for (my $i=0; $i < $num_parts; $i++) {
print "part number = $i\n";
my $part = $message->parts(1);
my $content_type = $part->mime_type;
my $body = $part->as_string;
print $body;
}
.......................
When I print the body I get the content headers as well. Is there a
way to just get the actual content?
-Matt