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

PARSING METHODS, NON-PUBLIC

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