1Mail::SpamAssassin::MesUssaegre:C:oNnotdrei(b3u)ted PerlMaDiolc:u:mSepnatmaAtsisoanssin::Message::Node(3)
2
3
4
6 Mail::SpamAssassin::Message::Node - decode, render, and make available
7 MIME message parts
8
10 This module will encapsulate an email message and allow access to the
11 various MIME message parts.
12
14 new()
15 Generates an empty Node object and returns it. Typically only
16 called by functions in Message.
17
18 find_parts()
19 Used to search the tree for specific MIME parts. An array of
20 matching Node objects (pointers into the tree) is returned. The
21 parameters that can be passed in are (in order, all scalars):
22
23 Regexp - Used to match against each part's Content-Type header,
24 specifically the type and not the rest of the header. ie:
25 "Content-type: text/html; encoding=quoted-printable" has a type of
26 "text/html". If no regexp is specified, find_parts() will return
27 an empty array.
28
29 Only_leaves - By default, find_parts() will return any part that
30 matches the regexp, including multipart. If you only want to see
31 leaves of the tree (ie: parts that aren't multipart), set this to
32 true (1).
33
34 Recursive - By default, when find_parts() finds a multipart which
35 has parts underneath it, it will recurse through all sub-children.
36 If set to 0, only look at the part and any direct children of the
37 part.
38
39 header()
40 Stores and retrieves headers from a specific MIME part. The first
41 parameter is the header name. If there is no other parameter, the
42 header is retrieved. If there is a second parameter, the header is
43 stored.
44
45 Header names are case-insensitive and are stored in both raw and
46 decoded form. Using header(), only the decoded form is
47 retrievable.
48
49 For retrieval, if header() is called in an array context, an array
50 will be returned with each header entry in a different element. In
51 a scalar context, the last specific header is returned.
52
53 ie: If 'Subject' is specified as the header, and there are 2
54 Subject headers in a message, the last/bottom one in the message is
55 returned in scalar context or both are returned in array context.
56
57 raw_header()
58 Retrieves the raw version of headers from a specific MIME part.
59 The only parameter is the header name. Header names are case-
60 insensitive.
61
62 For retrieval, if raw_header() is called in an array context, an
63 array will be returned with each header entry in a different
64 element. In a scalar context, the last specific header is
65 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 add_body_part()
72 Adds a Node child object to the current node object.
73
74 is_leaf()
75 Returns true if the tree node in question is a leaf of the tree
76 (ie: has no children of its own). Note: This function may return
77 odd results unless the message has been mime parsed via
78 _do_parse()!
79
80 raw()
81 Return a reference to the raw array. Treat this as READ ONLY.
82
83 decode()
84 If necessary, decode the part text as base64 or quoted-printable.
85 The decoded text will be returned as a scalar string. An optional
86 length parameter can be passed in which limits how much decoded
87 data is returned. If the scalar isn't needed, call with "0" as a
88 parameter.
89
90 rendered()
91 render_text() takes the given text/* type MIME part, and attempts
92 to render it into a text scalar. It will always render text/html,
93 and will use a heuristic to determine if other text/* parts should
94 be considered text/html. Two scalars are returned: the rendered
95 type (either text/html or whatever the original type was), and the
96 rendered text.
97
98 set_rendered($text, $type)
99 Set the rendered text and type for the given part. If type is not
100 specified, and text is a defined value, a default of 'text/plain'
101 is used. This can be used, for instance, to render non-text parts
102 using plugins.
103
104 visible_rendered()
105 Render and return the visible text in this part.
106
107 invisible_rendered()
108 Render and return the invisible text in this part.
109
110 content_summary()
111 Returns an array of scalars describing the mime parts of the
112 message. Note: This function requires that the message be parsed
113 first!
114
115 delete_header()
116 Delete the specified header (decoded and raw) from the Node
117 information.
118
119 get_header()
120 Retrieve a specific header. Will have a newline at the end and
121 will be unfolded. The first parameter is the header name (case-
122 insensitive), and the second parameter (optional) is whether or not
123 to return the raw header.
124
125 If get_header() is called in an array context, an array will be
126 returned with each header entry in a different element. In a
127 scalar context, the last specific header is returned.
128
129 ie: If 'Subject' is specified as the header, and there are 2
130 Subject headers in a message, the last/bottom one in the message is
131 returned in scalar context or both are returned in array context.
132
133 Btw, returning the last header field (not the first) happens to be
134 consistent with DKIM signatures, which search for and cover
135 multiple header fields bottom-up according to the 'h' tag. Let's
136 keep it this way.
137
138 get_all_headers()
139 Retrieve all headers. Each header will have a newline at the end
140 and will be unfolded. The first parameter (optional) is whether or
141 not to return the raw headers, and the second parameter (optional)
142 is whether or not to include the mbox separator.
143
144 If get_all_header() is called in an array context, an array will be
145 returned with each header entry in a different element. In a
146 scalar context, the headers are returned in a single scalar.
147
148
149
150perl v5.32.1 2021-04-1M4ail::SpamAssassin::Message::Node(3)