if ($MIME_entity->parts > 0) { for (my $i=0;$i<$MIME_entity->parts;$i++) { my $subEntity = $MIME_entity->parts($i); if (($types->{$subEntity->mime_type} eq 'text/html') || ($types->{$subEntity->mime_type} eq 'text/plain')) { if (my $io = $entity->open("r")) { while (defined($_=$io->getline)) {$recHash->{body} = $recHash->{body} . $_;} $io->close; } } } }