my Mail::Message $message = ...; if($message->isMultipart) { my Mail::Message::Part $part; foreach $part ($message->body->parts) { $part->print(\*OUT); my $attached_head = $part->head; my $attached_body = $part->body; # encoded as read my $attached_body = $part->decoded; # transfer-encoding removed } }
See SYNOPSIS in Mail::Message
A Mail::Message::Part
object contains a message which is included in
the body of an other message. For instance attachments are parts.
READ Mail::Message FIRST. A part is a special message: it has a reference to its parent message, and will usually not be sub-classed into mail folder specific variants.
See DESCRIPTION in Mail::Message