Thanks to Casey's help I know have this working like a glove ::
 
!/usr/bin/perl
 
use Mail::Internet;
my $mail = Mail::Internet->new(\*STDIN);
 
my $headers = $mail->head->header_hashref;
my @body = @{$mail->tidy_body()};
 
# Now what I'd like to do is get the text/plain part out of @body
# I could do somehting like this ::
 
if($headers->{'Content-Type'}->[0] !~ m/text\/plain/i) {
 
    my ($boundary) = $headers->{'Content-Type'}->[0] =~ m/boundary=\"(.*)\"/i;
# then manually parse @body by splitting it into parts at the $boundary
}
 
Is there an easier/faster/modular way to do this, I'm lookinf at the MIME::Parse 
(SP??) on cpan but not sure which direction to travel.
I guess what I'm looking for is something like this ::
 
@text_only = $mail->get_mime_part('text/plain',@body);
 
Thanks
 
Dan

Reply via email to