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 mes‐
7       sage
8

DESCRIPTION

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

PARSING METHODS, NON-PUBLIC

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