if ( $entity->is_multipart ) { for my $part ( $entity->parts ) { my $head = $part->head; if ( my $filename = $head->recommended_filename ) { print "Attachment name: $filename\n"; } my $body = $part->bodyhandle; if (my $path = $body->path) { print $path, "\n"; } } }