1Mail::SpamAssassin::MesUssaegre(C3o)ntributed Perl DocumMeanitla:t:iSopnamAssassin::Message(3)
2
3
4

NAME

6       Mail::SpamAssassin::Message - decode, render, and hold an RFC-2822
7       message
8

DESCRIPTION

10       This module encapsulates an email message and allows access to the
11       various MIME message parts and message metadata.
12
13       The message structure, after initiating a parse() cycle, looks like
14       this:
15
16         Message object, also top-level node in Message::Node tree
17            |
18            +---> Message::Node for other parts in MIME structure
19            |       |---> [ more Message::Node parts ... ]
20            |       [ others ... ]
21            |
22            +---> Message::Metadata object to hold metadata
23

PUBLIC METHODS

25       new()
26           Creates a Mail::SpamAssassin::Message object.  Takes a hash
27           reference as a parameter.  The used hash key/value pairs are as
28           follows:
29
30           "message" is either undef (which will use STDIN), a scalar of the
31           entire message, an array reference of the message with 1 line per
32           array element, and either a file glob or IO::File object which
33           holds the entire contents of the message.
34
35           Note: The message is expected to generally be in RFC 2822 format,
36           optionally including an mbox message separator line (the "From "
37           line) as the first line.
38
39           "parse_now" specifies whether or not to create the MIME tree at
40           object-creation time or later as necessary.
41
42           The parse_now option, by default, is set to false (0).  This allows
43           SpamAssassin to not have to generate the tree of
44           Mail::SpamAssassin::Message::Node objects and their related data if
45           the tree is not going to be used.  This is handy, for instance,
46           when running "spamassassin -d", which only needs the pristine
47           header and body which is always handled when the object is created.
48
49           "subparse" specifies how many MIME recursion levels should be
50           parsed.  Defaults to 20.
51
52       find_parts()
53           Used to search the tree for specific MIME parts.  See
54           Mail::SpamAssassin::Message::Node for more details.
55
56       get_pristine_header()
57           Returns pristine headers of the message.  If no specific header
58           name is given as a parameter (case-insensitive), then all headers
59           will be returned as a scalar, including the blank line at the end
60           of the headers.
61
62           If called in an array context, an array will be returned with each
63           specific header in a different element.  In a scalar context, the
64           last specific header is returned.
65
66           ie: If 'Subject' is specified as the header, and there are 2
67           Subject headers in a message, the last/bottom one in the message is
68           returned in scalar context or both are returned in array context.
69
70           Btw, returning the last header field (not the first) happens to be
71           consistent with DKIM signatures, which search for and cover
72           multiple header fields bottom-up according to the 'h' tag. Let's
73           keep it this way.
74
75           Note: the returned header will include the ending newline and any
76           embedded whitespace folding.
77
78       get_mbox_separator()
79           Returns the mbox separator found in the message, or undef if there
80           wasn't one.
81
82       get_body()
83           Returns an array of the pristine message body, one line per array
84           element.
85
86       get_pristine()
87           Returns a scalar of the entire pristine message.
88
89       get_pristine_body()
90           Returns a scalar of the pristine message body.
91
92       extract_message_metadata($permsgstatus)
93       $str = get_metadata($hdr)
94       put_metadata($hdr, $text)
95       delete_metadata($hdr)
96       $str = get_all_metadata()
97       finish_metadata()
98           Destroys the metadata for this message.  Once a message has been
99           scanned fully, the metadata is no longer required.   Destroying
100           this will free up some memory.
101
102       finish()
103           Clean up an object so that it can be destroyed.
104
105       receive_date()
106           Return a time_t value with the received date of the current
107           message, or current time if received time couldn't be determined.
108

PARSING METHODS, NON-PUBLIC

110       These methods take a RFC2822-esque formatted message and create a tree
111       with all of the MIME body parts included.  Those parts will be decoded
112       as necessary, and text/html parts will be rendered into a standard text
113       format, suitable for use in SpamAssassin.
114
115       parse_body()
116           parse_body() passes the body part that was passed in onto the
117           correct part parser, either _parse_multipart() for multipart/*
118           parts, or _parse_normal() for everything else.  Multipart sections
119           become the root of sub-trees, while everything else becomes a leaf
120           in the tree.
121
122           For multipart messages, the first call to parse_body() doesn't
123           create a new sub-tree and just uses the parent node to contain
124           children.  All other calls to parse_body() will cause a new sub-
125           tree root to be created and children will exist underneath that
126           root.  (this is just so the tree doesn't have a root node which
127           points at the actual root node ...)
128
129       _parse_multipart()
130           Generate a root node, and for each child part call parse_body() to
131           generate the tree.
132
133       _parse_normal()
134           Generate a leaf node and add it to the parent.
135
136
137
138perl v5.12.4                      2011-06-06    Mail::SpamAssassin::Message(3)
Impressum