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
11 This module will encapsulate an email message and allow access to the
12 various MIME message parts.
13
15 new()
16 Generates an empty Node object and returns it. Typically only
17 called by functions in Message.
18
19 find_parts()
20 Used to search the tree for specific MIME parts. An array of
21 matching Node objects (pointers into the tree) is returned. The
22 parameters that can be passed in are (in order, all scalars):
23
24 Regexp - Used to match against each part's Content-Type header,
25 specifically the type and not the rest of the header. ie: "Con‐
26 tent-type: text/html; encoding=quoted-printable" has a type of
27 "text/html". If no regexp is specified, find_parts() will return
28 an empty array.
29
30 Only_leaves - By default, find_parts() will return any part that
31 matches the regexp, including multipart. If you only want to see
32 leaves of the tree (ie: parts that aren't multipart), set this to
33 true (1).
34
35 Recursive - By default, when find_parts() finds a multipart which
36 has parts underneath it, it will recurse through all sub-children.
37 If set to 0, only look at the part and any direct children of the
38 part.
39
40 header()
41 Stores and retrieves headers from a specific MIME part. The first
42 parameter is the header name. If there is no other parameter, the
43 header is retrieved. If there is a second parameter, the header is
44 stored.
45
46 Header names are case-insensitive and are stored in both raw and
47 decoded form. Using header(), only the decoded form is retriev‐
48 able.
49
50 For retrieval, if header() is called in an array context, an array
51 will be returned with each header entry in a different element. In
52 a scalar context, the last specific header is returned.
53
54 ie: If 'Subject' is specified as the header, and there are 2 Sub‐
55 ject headers in a message, the last/bottom one in the message is
56 returned in scalar context or both are returned in array context.
57
58 raw_header()
59 Retrieves the raw version of headers from a specific MIME part.
60 The only parameter is the header name. Header names are
61 case-insensitive.
62
63 For retrieval, if raw_header() is called in an array context, an
64 array will be returned with each header entry in a different ele‐
65 ment. In a scalar context, the last specific header is returned.
66
67 ie: If 'Subject' is specified as the header, and there are 2 Sub‐
68 ject 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 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 mes‐
112 sage. 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 infor‐
117 mation.
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
122 (case-insensitive), and the second parameter (optional) is whether
123 or not 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 Sub‐
130 ject 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 get_all_headers()
134 Retrieve all headers. Each header will have a newline at the end
135 and will be unfolded. The first parameter (optional) is whether or
136 not to return the raw headers, and the second parameter (optional)
137 is whether or not to include the mbox separator.
138
139 If get_all_header() is called in an array context, an array will be
140 returned with each header entry in a different element. In a
141 scalar context, the headers are returned in a single scalar.
142
143
144
145perl v5.8.8 2008-01-0M5ail::SpamAssassin::Message::Node(3)