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:
26 "Content-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
48 retrievable.
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
55 Subject 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 case-
61 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
65 element. In a scalar context, the last specific header is
66 returned.
67
68 ie: If 'Subject' is specified as the header, and there are 2
69 Subject headers in a message, the last/bottom one in the message is
70 returned in scalar context or both are returned in array context.
71
72 add_body_part()
73 Adds a Node child object to the current node object.
74
75 is_leaf()
76 Returns true if the tree node in question is a leaf of the tree
77 (ie: has no children of its own). Note: This function may return
78 odd results unless the message has been mime parsed via
79 _do_parse()!
80
81 raw()
82 Return a reference to the the raw array. Treat this as READ ONLY.
83
84 decode()
85 If necessary, decode the part text as base64 or quoted-printable.
86 The decoded text will be returned as a scalar string. An optional
87 length parameter can be passed in which limits how much decoded
88 data is returned. If the scalar isn't needed, call with "0" as a
89 parameter.
90
91 rendered()
92 render_text() takes the given text/* type MIME part, and attempts
93 to render it into a text scalar. It will always render text/html,
94 and will use a heuristic to determine if other text/* parts should
95 be considered text/html. Two scalars are returned: the rendered
96 type (either text/html or whatever the original type was), and the
97 rendered text.
98
99 set_rendered($text, $type)
100 Set the rendered text and type for the given part. If type is not
101 specified, and text is a defined value, a default of 'text/plain'
102 is used. This can be used, for instance, to render non-text parts
103 using plugins.
104
105 visible_rendered()
106 Render and return the visible text in this part.
107
108 invisible_rendered()
109 Render and return the invisible text in this part.
110
111 content_summary()
112 Returns an array of scalars describing the mime parts of the
113 message. Note: This function requires that the message be parsed
114 first!
115
116 delete_header()
117 Delete the specified header (decoded and raw) from the Node
118 information.
119
120 get_header()
121 Retrieve a specific header. Will have a newline at the end and
122 will be unfolded. The first parameter is the header name (case-
123 insensitive), and the second parameter (optional) is whether or not
124 to return the raw header.
125
126 If get_header() is called in an array context, an array will be
127 returned with each header entry in a different element. In a
128 scalar context, the last specific header is returned.
129
130 ie: If 'Subject' is specified as the header, and there are 2
131 Subject headers in a message, the last/bottom one in the message is
132 returned in scalar context or both are returned in array context.
133
134 Btw, returning the last header field (not the first) happens to be
135 consistent with DKIM signatures, which search for and cover
136 multiple header fields bottom-up according to the 'h' tag. Let's
137 keep it this way.
138
139 get_all_headers()
140 Retrieve all headers. Each header will have a newline at the end
141 and will be unfolded. The first parameter (optional) is whether or
142 not to return the raw headers, and the second parameter (optional)
143 is whether or not to include the mbox separator.
144
145 If get_all_header() is called in an array context, an array will be
146 returned with each header entry in a different element. In a
147 scalar context, the headers are returned in a single scalar.
148
149
150
151perl v5.10.1 2010-03-1M6ail::SpamAssassin::Message::Node(3)