Email::MIME::XPath is a Perl module that allows you to access MIME documents via XPath queries.
SYNOPSIS
use Email::MIME;
use Email::MIME::XPath;
my $email = Email::MIME->new($data);
# find just the first text/plain node, no matter how many there are
my ($part) = $email->xpath_findnodes('//plain');
# find the only text/html node, and die if there is more than one
$part = $email->xpath_findnode('//html');
# look for a png by filename
$part = $email->xpath_findnode('//png[@filename="image.png"]');
# retrieve a part by previously-stored address
my $address = $part->xpath_address;
# ... later ...
$part = $email->xpath_findnode(qq{//*[@address="$address"]});
Dealing with MIME messages can be complicated. Frequently you want to display certain parts of a message, while alluding to (linking, summarizing, whatever) other parts in a way that makes them easy to get to later. Sometimes this can go several levels deep, if you're dealing with forwarded messages, bounces, or reports of some kind.
It is especially referring back to sub-parts of an arbitrarily deep MIME message that is tedious and that this module attempts to make easier.
Product's homepage
Requirements:
· Perl