1Mail::Message::Part(3)User Contributed Perl DocumentationMail::Message::Part(3)
2
3
4

NAME

6       Mail::Message::Part - a part of a message, but a message by itself
7

INHERITANCE

9        Mail::Message::Part
10          is a Mail::Message
11          is a Mail::Reporter
12

SYNOPSIS

14        my Mail::Message $message = ...;
15        if($message->isMultipart) {
16           my Mail::Message::Part $part;
17
18           foreach $part ($message->body->parts) {
19              $part->print(\*OUT);
20              my $attached_head = $part->head;
21              my $attached_body = $part->body;      # encoded as read
22              my $attached_body = $part->decoded;   # transfer-encoding removed
23           }
24        }
25

DESCRIPTION

27       A "Mail::Message::Part" object contains a message which is included in
28       the body of an other message.  For instance attachments are parts.
29
30       READ Mail::Message FIRST.  A part is a special message: it has a
31       reference to its parent message, and will usually not be sub-classed
32       into mail folder specific variants.
33

METHODS

35   Constructors
36       $obj->clone(OPTIONS)
37           See "Constructors" in Mail::Message
38
39       Mail::Message::Part->new(OPTIONS)
40           Create a message part.
41
42            -Option    --Defined in     --Default
43             body        Mail::Message    undef
44             body_type   Mail::Message    Mail::Message::Body::Lines
45             container                    <required>
46             deleted     Mail::Message    <false>
47             field_type  Mail::Message    undef
48             head        Mail::Message    <empty header>
49             head_type   Mail::Message    Mail::Message::Head::Complete
50             labels      Mail::Message    {}
51             log         Mail::Reporter   'WARNINGS'
52             messageId   Mail::Message    undef
53             modified    Mail::Message    <false>
54             trace       Mail::Reporter   'WARNINGS'
55             trusted     Mail::Message    <false>
56
57           body => OBJECT
58           body_type => CLASS
59           container => BODY
60             Reference to the parental Mail::Message::Body object where this
61             part is a member of.  That object may be a
62             Mail::Message::Body::Multipart or a Mail::Message::Body::Nested.
63
64           deleted => BOOLEAN
65           field_type => CLASS
66           head => OBJECT
67           head_type => CLASS
68           labels => ARRAY|HASH
69           log => LEVEL
70           messageId => STRING
71           modified => BOOLEAN
72           trace => LEVEL
73           trusted => BOOLEAN
74
75   Constructing a message
76       $obj->bounce([RG-OBJECT|OPTIONS])
77           See "Constructing a message" in Mail::Message::Construct::Bounce
78
79       Mail::Message::Part->build([MESSAGE|PART|BODY], CONTENT)
80           See "Constructing a message" in Mail::Message::Construct::Build
81
82       Mail::Message::Part->buildFromBody(BODY, CONTAINER, HEADERS)
83           Shape a message part around a BODY.  Bodies have information about
84           their content in them, which is used to construct a header for the
85           message.  Next to that, more HEADERS can be specified.  No headers
86           are obligatory.  No extra headers are fabricated automatically.
87
88           example:
89
90            my $multi = Mail::Message::Body::Multipart->new;
91            my $part  = Mail::Message::Part->buildFromBody($body, $multi);
92
93       $obj->forward(OPTIONS)
94           See "Constructing a message" in Mail::Message::Construct::Forward
95
96       $obj->forwardAttach(OPTIONS)
97           See "Constructing a message" in Mail::Message::Construct::Forward
98
99       $obj->forwardEncapsulate(OPTIONS)
100           See "Constructing a message" in Mail::Message::Construct::Forward
101
102       $obj->forwardInline(OPTIONS)
103           See "Constructing a message" in Mail::Message::Construct::Forward
104
105       $obj->forwardNo(OPTIONS)
106           See "Constructing a message" in Mail::Message::Construct::Forward
107
108       $obj->forwardPostlude
109           See "Constructing a message" in Mail::Message::Construct::Forward
110
111       $obj->forwardPrelude
112           See "Constructing a message" in Mail::Message::Construct::Forward
113
114       $obj->forwardSubject(STRING)
115           See "Constructing a message" in Mail::Message::Construct::Forward
116
117       Mail::Message::Part->read(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES,
118       OPTIONS)
119           See "Constructing a message" in Mail::Message::Construct::Read
120
121       $obj->rebuild(OPTIONS)
122           See "Constructing a message" in Mail::Message::Construct::Rebuild
123
124       $obj->reply(OPTIONS)
125           See "Constructing a message" in Mail::Message::Construct::Reply
126
127       $obj->replyPrelude([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
128           See "Constructing a message" in Mail::Message::Construct::Reply
129
130       $obj->replySubject(STRING)
131           Mail::Message::Part->replySubject(STRING)
132
133           See "Constructing a message" in Mail::Message::Construct::Reply
134
135   The message
136       $obj->container
137           See "The message" in Mail::Message
138
139       $obj->isDummy
140           See "The message" in Mail::Message
141
142       $obj->isPart
143           See "The message" in Mail::Message
144
145       $obj->messageId
146           See "The message" in Mail::Message
147
148       $obj->print([FILEHANDLE])
149           See "The message" in Mail::Message
150
151       $obj->printEscapedFrom(FILEHANDLE)
152           Prints the message part, but all lines which start with 'From '
153           will get a leading >.  See Mail::Message::Body::printEscapedFrom().
154
155       $obj->send([MAILER], OPTIONS)
156           See "The message" in Mail::Message
157
158       $obj->size
159           See "The message" in Mail::Message
160
161       $obj->toplevel
162           See "The message" in Mail::Message
163
164       $obj->write([FILEHANDLE])
165           See "The message" in Mail::Message
166
167   The header
168       $obj->bcc
169           See "The header" in Mail::Message
170
171       $obj->cc
172           See "The header" in Mail::Message
173
174       $obj->date
175           See "The header" in Mail::Message
176
177       $obj->destinations
178           See "The header" in Mail::Message
179
180       $obj->from
181           See "The header" in Mail::Message
182
183       $obj->get(FIELDNAME)
184           See "The header" in Mail::Message
185
186       $obj->guessTimestamp
187           See "The header" in Mail::Message
188
189       $obj->head([HEAD])
190           See "The header" in Mail::Message
191
192       $obj->nrLines
193           See "The header" in Mail::Message
194
195       $obj->sender
196           See "The header" in Mail::Message
197
198       $obj->study(FIELDNAME)
199           See "The header" in Mail::Message
200
201       $obj->subject
202           See "The header" in Mail::Message
203
204       $obj->timestamp
205           See "The header" in Mail::Message
206
207       $obj->to
208           See "The header" in Mail::Message
209
210   The body
211       $obj->body([BODY])
212           See "The body" in Mail::Message
213
214       $obj->contentType
215           See "The body" in Mail::Message
216
217       $obj->decoded(OPTIONS)
218           See "The body" in Mail::Message
219
220       $obj->encode(OPTIONS)
221           See "The body" in Mail::Message
222
223       $obj->isMultipart
224           See "The body" in Mail::Message
225
226       $obj->isNested
227           See "The body" in Mail::Message
228
229       $obj->parts(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
230           See "The body" in Mail::Message
231
232   Flags
233       $obj->delete
234           See "Flags" in Mail::Message
235
236       $obj->deleted([BOOLEAN])
237           See "Flags" in Mail::Message
238
239       $obj->isDeleted
240           See "Flags" in Mail::Message
241
242       $obj->isModified
243           See "Flags" in Mail::Message
244
245       $obj->label(LABEL|PAIRS)
246           See "Flags" in Mail::Message
247
248       $obj->labels
249           See "Flags" in Mail::Message
250
251       $obj->labelsToStatus
252           See "Flags" in Mail::Message
253
254       $obj->modified([BOOLEAN])
255           See "Flags" in Mail::Message
256
257       $obj->statusToLabels
258           See "Flags" in Mail::Message
259
260   The whole message as text
261       $obj->file
262           See "The whole message as text" in Mail::Message::Construct::Text
263
264       $obj->lines
265           See "The whole message as text" in Mail::Message::Construct::Text
266
267       $obj->printStructure([FILEHANDLE|undef],[INDENT])
268           See "The whole message as text" in Mail::Message::Construct::Text
269
270       $obj->string
271           See "The whole message as text" in Mail::Message::Construct::Text
272
273   Internals
274       $obj->clonedFrom
275           See "Internals" in Mail::Message
276
277       Mail::Message::Part->coerce(BODY|MESSAGE, MULTIPART, HEADERS)
278           Transforms a BODY or MESSAGE to a real message part.  The MULTIPART
279           refers to the parental body.
280
281           When ta BODY is specified, extra HEADERS can be supplied as well.
282           Bodies are coerced into message parts by calling buildFromBody().
283           If you specify a MESSAGE residing in a folder, this message will
284           automatically be cloned.
285
286       $obj->isDelayed
287           See "Internals" in Mail::Message
288
289       $obj->readBody(PARSER, HEAD [, BODYTYPE])
290           See "Internals" in Mail::Message
291
292       $obj->readFromParser(PARSER, [BODYTYPE])
293           See "Internals" in Mail::Message
294
295       $obj->readHead(PARSER [,CLASS])
296           See "Internals" in Mail::Message
297
298       $obj->recursiveRebuildPart(PART, OPTIONS)
299           See "Internals" in Mail::Message::Construct::Rebuild
300
301       $obj->storeBody(BODY)
302           See "Internals" in Mail::Message
303
304       $obj->takeMessageId([STRING])
305           See "Internals" in Mail::Message
306
307   Error handling
308       $obj->AUTOLOAD
309           See "METHODS" in Mail::Message::Construct
310
311       $obj->addReport(OBJECT)
312           See "Error handling" in Mail::Reporter
313
314       $obj->defaultTrace([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK])
315           Mail::Message::Part->defaultTrace([LEVEL]|[LOGLEVEL,
316           TRACELEVEL]|[LEVEL, CALLBACK])
317
318           See "Error handling" in Mail::Reporter
319
320       $obj->errors
321           See "Error handling" in Mail::Reporter
322
323       $obj->log([LEVEL [,STRINGS]])
324           Mail::Message::Part->log([LEVEL [,STRINGS]])
325
326           See "Error handling" in Mail::Reporter
327
328       $obj->logPriority(LEVEL)
329           Mail::Message::Part->logPriority(LEVEL)
330
331           See "Error handling" in Mail::Reporter
332
333       $obj->logSettings
334           See "Error handling" in Mail::Reporter
335
336       $obj->notImplemented
337           See "Error handling" in Mail::Reporter
338
339       $obj->report([LEVEL])
340           See "Error handling" in Mail::Reporter
341
342       $obj->reportAll([LEVEL])
343           See "Error handling" in Mail::Reporter
344
345       $obj->shortSize([VALUE])
346           Mail::Message::Part->shortSize([VALUE])
347
348           See "Error handling" in Mail::Message
349
350       $obj->shortString
351           See "Error handling" in Mail::Message
352
353       $obj->trace([LEVEL])
354           See "Error handling" in Mail::Reporter
355
356       $obj->warnings
357           See "Error handling" in Mail::Reporter
358
359   Cleanup
360       $obj->DESTROY
361           See "Cleanup" in Mail::Message
362
363       $obj->destruct
364           Message parts can not be destructed per part: only whole messages
365           can be forcefully freed from memory.  Of course, you can delete()
366           separate parts, which only sets a flag not to write a part again.
367           Furthermore, you may cosider rebuild() to get rit of deleted parts.
368
369       $obj->inGlobalDestruction
370           See "Cleanup" in Mail::Reporter
371

DIAGNOSTICS

373       Error: Cannot include forward source as $include.
374           Unknown alternative for the forward(include).  Valid choices are
375           "NO", "INLINE", "ATTACH", and "ENCAPSULATE".
376
377       Error: Cannot include reply source as $include.
378           Unknown alternative for the "include" option of reply().  Valid
379           choices are "NO", "INLINE", and "ATTACH".
380
381       Error: Method bounce requires To, Cc, or Bcc
382           The message bounce() method forwards a received message off to
383           someone else without modification; you must specified it's new
384           destination.  If you have the urge not to specify any destination,
385           you probably are looking for reply(). When you wish to modify the
386           content, use forward().
387
388       Error: Method forwardAttach requires a preamble
389       Error: Method forwardEncapsulate requires a preamble
390       Error: No address to create forwarded to.
391           If a forward message is created, a destination address must be
392           specified.
393
394       Error: No default mailer found to send message.
395           The message send() mechanism had not enough information to
396           automatically find a mail transfer agent to sent this message.
397           Specify a mailer explicitly using the "via" options.
398
399       Error: No rebuild rule $name defined.
400       Error: Only build() Mail::Message's; they are not in a folder yet
401           You may wish to construct a message to be stored in a some kind of
402           folder, but you need to do that in two steps.  First, create a
403           normal Mail::Message, and then add it to the folder.  During this
404           Mail::Box::addMessage() process, the message will get coerce()-d
405           into the right message type, adding storage information and the
406           like.
407
408       Error: Package $package does not implement $method.
409           Fatal error: the specific package (or one of its superclasses) does
410           not implement this method where it should. This message means that
411           some other related classes do implement this method however the
412           class at hand does not.  Probably you should investigate this and
413           probably inform the author of the package.
414
415       Error: You cannot destruct message parts, only whole messages
416           Message parts can not be destructed per part: only whole messages
417           can be forcefully freed from memory. Consider delete() or
418           rebuild().
419

SEE ALSO

421       This module is part of Mail-Box distribution version 2.097, built on
422       January 26, 2011. Website: http://perl.overmeer.net/mailbox/
423

LICENSE

425       Copyrights 2001-2011 by Mark Overmeer. For other contributors see
426       ChangeLog.
427
428       This program is free software; you can redistribute it and/or modify it
429       under the same terms as Perl itself.  See
430       http://www.perl.com/perl/misc/Artistic.html
431
432
433
434perl v5.12.3                      2011-01-26            Mail::Message::Part(3)
Impressum