Mail::SpamAssassin::Message - decode, render, and hold an RFC-2822 message
This module will encapsulate an email message and allow access to the various MIME message parts and message metadata.
new()
message
is either undef (which will use STDIN), a scalar of the
entire message, an array reference of the message with 1 line per array
element, or a file glob which holds the entire contents of the message.
parse_now
specifies whether or not to create the MIME tree
at object-creation time or later as necessary.
The parse_now option, by default, is set to false (0).
This allows SpamAssassin to not have to generate the tree of
Mail::SpamAssassin::Message::Node objects and their related data if the
tree is not going to be used. This is handy, for instance, when running
spamassassin -d
, which only needs the pristine header and body which
is always handled when the object is created.
_do_parse()
find_parts()
as necessary.
find_parts()
get_pristine_header()
If called in an array context, an array will be returned with each specific header in a different element. In a scalar context, the last specific header is returned.
ie: If 'Subject' is specified as the header, and there are 2 Subject headers in a message, the last/bottom one in the message is returned in scalar context or both are returned in array context.
Note: the returned header will include the ending newline and any embedded whitespace folding.
get_mbox_separator()
get_body()
get_pristine()
get_pristine_body()
These methods take a RFC2822-esque formatted message and create a tree with all of the MIME body parts included. Those parts will be decoded as necessary, and text/html parts will be rendered into a standard text format, suitable for use in SpamAssassin.
parse_body()
parse_body()
passes the body part that was passed in onto the
correct part parser, either _parse_multipart()
for multipart/* parts,
or _parse_normal()
for everything else. Multipart sections become the
root of sub-trees, while everything else becomes a leaf in the tree.
For multipart messages, the first call to parse_body()
doesn't create a
new sub-tree and just uses the parent node to contain children. All other
calls to parse_body()
will cause a new sub-tree root to be created and
children will exist underneath that root. (this is just so the tree
doesn't have a root node which points at the actual root node ...)
_parse_multipart()
parse_body()
to generate the tree.
_parse_normal()
get_metadata($hdr)
get_metadata($hdr)
delete_metadata($hdr)
get_all_metadata()
finish_metadata()
finish()
receive_date()