1Mail::Message::Part(3)User Contributed Perl DocumentationMail::Message::Part(3)
2
3
4
6 Mail::Message::Part - a part of a message, but a message by itself
7
9 Mail::Message::Part
10 is a Mail::Message
11 is a Mail::Reporter
12
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
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 refer‐
31 ence to its parent message, and will usually not be sub-classed into
32 mail folder specific variants.
33
35 $obj->printEscapedFrom(FILEHANDLE)
36
37 Prints the message part, but all lines which start with 'From '
38 will get a leading "gt". See Mail::Message::Body::printEscaped‐
39 From().
40
41 Constructors
42
43 $obj->clone(OPTIONS)
44
45 See "Constructors" in Mail::Message
46
47 Mail::Message::Part->new(OPTIONS)
48
49 Create a message part.
50
51 Option --Defined in --Default
52 body Mail::Message undef
53 body_type Mail::Message Mail::Message::Body::Lines
54 container <required>
55 deleted Mail::Message <false>
56 field_type Mail::Message undef
57 head Mail::Message <empty header>
58 head_type Mail::Message Mail::Message::Head::Complete
59 labels Mail::Message {}
60 log Mail::Reporter 'WARNINGS'
61 messageId Mail::Message undef
62 modified Mail::Message <false>
63 trace Mail::Reporter 'WARNINGS'
64 trusted Mail::Message <false>
65
66 . body OBJECT
67
68 . body_type CLASS
69
70 . container BODY
71
72 Reference to the parental Mail::Message::Body object where this
73 part is a member of. That object may be a Mail::Mes‐
74 sage::Body::Multipart or a Mail::Message::Body::Nested.
75
76 . deleted BOOLEAN
77
78 . field_type CLASS
79
80 . head OBJECT
81
82 . head_type CLASS
83
84 . labels ARRAY⎪HASH
85
86 . log LEVEL
87
88 . messageId STRING
89
90 . modified BOOLEAN
91
92 . trace LEVEL
93
94 . trusted BOOLEAN
95
96 Constructing a message
97
98 $obj->bounce([RG-OBJECT⎪OPTIONS])
99
100 See "Constructing a message" in Mail::Message::Construct::Bounce
101
102 Mail::Message::Part->build([MESSAGE⎪PART⎪BODY], CONTENT)
103
104 See "Constructing a message" in Mail::Message::Construct::Build
105
106 Mail::Message::Part->buildFromBody(BODY, CONTAINER, HEADERS)
107
108 Shape a message part around a BODY. Bodies have information about
109 their content in them, which is used to construct a header for the
110 message. Next to that, more HEADERS can be specified. No headers
111 are obligatory. No extra headers are fabricated automatically.
112
113 Example:
114
115 my $multi = Mail::Message::Body::Multipart->new;
116 my $part = Mail::Message::Part->buildFromBody($body, $multi);
117
118 $obj->forward(OPTIONS)
119
120 See "Constructing a message" in Mail::Message::Construct::Forward
121
122 $obj->forwardAttach(OPTIONS)
123
124 See "Constructing a message" in Mail::Message::Construct::Forward
125
126 $obj->forwardEncapsulate(OPTIONS)
127
128 See "Constructing a message" in Mail::Message::Construct::Forward
129
130 $obj->forwardInline(OPTIONS)
131
132 See "Constructing a message" in Mail::Message::Construct::Forward
133
134 $obj->forwardNo(OPTIONS)
135
136 See "Constructing a message" in Mail::Message::Construct::Forward
137
138 $obj->forwardPostlude
139
140 See "Constructing a message" in Mail::Message::Construct::Forward
141
142 $obj->forwardPrelude
143
144 See "Constructing a message" in Mail::Message::Construct::Forward
145
146 $obj->forwardSubject(STRING)
147
148 See "Constructing a message" in Mail::Message::Construct::Forward
149
150 Mail::Message::Part->read(FILEHANDLE⎪SCALAR⎪REF-SCALAR⎪ARRAY-OF-LINES,
151 OPTIONS)
152
153 See "Constructing a message" in Mail::Message::Construct::Read
154
155 $obj->rebuild(OPTIONS)
156
157 See "Constructing a message" in Mail::Message::Construct::Rebuild
158
159 $obj->reply(OPTIONS)
160
161 See "Constructing a message" in Mail::Message::Construct::Reply
162
163 $obj->replyPrelude([STRING⎪FIELD⎪ADDRESS⎪ARRAY-OF-THINGS])
164
165 See "Constructing a message" in Mail::Message::Construct::Reply
166
167 $obj->replySubject(STRING)
168
169 Mail::Message::Part->replySubject(STRING)
170
171 See "Constructing a message" in Mail::Message::Construct::Reply
172
173 The message
174
175 $obj->container
176
177 See "The message" in Mail::Message
178
179 $obj->isDummy
180
181 See "The message" in Mail::Message
182
183 $obj->isPart
184
185 See "The message" in Mail::Message
186
187 $obj->messageId
188
189 See "The message" in Mail::Message
190
191 $obj->print([FILEHANDLE])
192
193 See "The message" in Mail::Message
194
195 $obj->send([MAILER], OPTIONS)
196
197 See "The message" in Mail::Message
198
199 $obj->size
200
201 See "The message" in Mail::Message
202
203 $obj->toplevel
204
205 See "The message" in Mail::Message
206
207 $obj->write([FILEHANDLE])
208
209 See "The message" in Mail::Message
210
211 The header
212
213 $obj->bcc
214
215 See "The header" in Mail::Message
216
217 $obj->cc
218
219 See "The header" in Mail::Message
220
221 $obj->date
222
223 See "The header" in Mail::Message
224
225 $obj->destinations
226
227 See "The header" in Mail::Message
228
229 $obj->from
230
231 See "The header" in Mail::Message
232
233 $obj->get(FIELDNAME)
234
235 See "The header" in Mail::Message
236
237 $obj->guessTimestamp
238
239 See "The header" in Mail::Message
240
241 $obj->head([HEAD])
242
243 See "The header" in Mail::Message
244
245 $obj->nrLines
246
247 See "The header" in Mail::Message
248
249 $obj->sender
250
251 See "The header" in Mail::Message
252
253 $obj->study(FIELDNAME)
254
255 See "The header" in Mail::Message
256
257 $obj->subject
258
259 See "The header" in Mail::Message
260
261 $obj->timestamp
262
263 See "The header" in Mail::Message
264
265 $obj->to
266
267 See "The header" in Mail::Message
268
269 The body
270
271 $obj->body([BODY])
272
273 See "The body" in Mail::Message
274
275 $obj->decoded(OPTIONS)
276
277 See "The body" in Mail::Message
278
279 $obj->encode(OPTIONS)
280
281 See "The body" in Mail::Message
282
283 $obj->isMultipart
284
285 See "The body" in Mail::Message
286
287 $obj->isNested
288
289 See "The body" in Mail::Message
290
291 $obj->parts(['ALL'⎪'ACTIVE'⎪'DELETED'⎪'RECURSE'⎪FILTER])
292
293 See "The body" in Mail::Message
294
295 Flags
296
297 $obj->delete
298
299 See "Flags" in Mail::Message
300
301 $obj->deleted([BOOLEAN])
302
303 See "Flags" in Mail::Message
304
305 $obj->isDeleted
306
307 See "Flags" in Mail::Message
308
309 $obj->isModified
310
311 See "Flags" in Mail::Message
312
313 $obj->label(LABEL⎪PAIRS)
314
315 See "Flags" in Mail::Message
316
317 $obj->labels
318
319 See "Flags" in Mail::Message
320
321 $obj->labelsToStatus
322
323 See "Flags" in Mail::Message
324
325 $obj->modified([BOOLEAN])
326
327 See "Flags" in Mail::Message
328
329 $obj->statusToLabels
330
331 See "Flags" in Mail::Message
332
333 The whole message as text
334
335 $obj->file
336
337 See "The whole message as text" in Mail::Message::Construct::Text
338
339 $obj->lines
340
341 See "The whole message as text" in Mail::Message::Construct::Text
342
343 $obj->printStructure([FILEHANDLE⎪undef],[INDENT])
344
345 See "The whole message as text" in Mail::Message::Construct::Text
346
347 $obj->string
348
349 See "The whole message as text" in Mail::Message::Construct::Text
350
351 Internals
352
353 $obj->clonedFrom
354
355 See "Internals" in Mail::Message
356
357 Mail::Message::Part->coerce(BODY⎪MESSAGE, MULTIPART, HEADERS)
358
359 Transforms a BODY or MESSAGE to a real message part. The MULTIPART
360 refers to the parental body.
361
362 When ta BODY is specified, extra HEADERS can be supplied as well.
363 Bodies are coerced into message parts by calling buildFromBody().
364 If you specify a MESSAGE residing in a folder, this message will
365 automatically be cloned.
366
367 $obj->isDelayed
368
369 See "Internals" in Mail::Message
370
371 $obj->readBody(PARSER, HEAD [, BODYTYPE])
372
373 See "Internals" in Mail::Message
374
375 $obj->readFromParser(PARSER, [BODYTYPE])
376
377 See "Internals" in Mail::Message
378
379 $obj->readHead(PARSER [,CLASS])
380
381 See "Internals" in Mail::Message
382
383 $obj->recursiveRebuildPart(PART, OPTIONS)
384
385 See "Internals" in Mail::Message::Construct::Rebuild
386
387 $obj->storeBody(BODY)
388
389 See "Internals" in Mail::Message
390
391 $obj->takeMessageId([STRING])
392
393 See "Internals" in Mail::Message
394
395 Error handling
396
397 $obj->AUTOLOAD
398
399 See "METHODS" in Mail::Message::Construct
400
401 $obj->addReport(OBJECT)
402
403 See "Error handling" in Mail::Reporter
404
405 $obj->defaultTrace([LEVEL]⎪[LOGLEVEL, TRACELEVEL]⎪[LEVEL, CALLBACK])
406
407 Mail::Message::Part->defaultTrace([LEVEL]⎪[LOGLEVEL,
408 TRACELEVEL]⎪[LEVEL, CALLBACK])
409
410 See "Error handling" in Mail::Reporter
411
412 $obj->errors
413
414 See "Error handling" in Mail::Reporter
415
416 $obj->log([LEVEL [,STRINGS]])
417
418 Mail::Message::Part->log([LEVEL [,STRINGS]])
419
420 See "Error handling" in Mail::Reporter
421
422 $obj->logPriority(LEVEL)
423
424 Mail::Message::Part->logPriority(LEVEL)
425
426 See "Error handling" in Mail::Reporter
427
428 $obj->logSettings
429
430 See "Error handling" in Mail::Reporter
431
432 $obj->notImplemented
433
434 See "Error handling" in Mail::Reporter
435
436 $obj->report([LEVEL])
437
438 See "Error handling" in Mail::Reporter
439
440 $obj->reportAll([LEVEL])
441
442 See "Error handling" in Mail::Reporter
443
444 $obj->shortSize([VALUE])
445
446 Mail::Message::Part->shortSize([VALUE])
447
448 See "Error handling" in Mail::Message
449
450 $obj->shortString
451
452 See "Error handling" in Mail::Message
453
454 $obj->trace([LEVEL])
455
456 See "Error handling" in Mail::Reporter
457
458 $obj->warnings
459
460 See "Error handling" in Mail::Reporter
461
462 Cleanup
463
464 $obj->DESTROY
465
466 See "Cleanup" in Mail::Message
467
468 $obj->destruct
469
470 Message parts can not be destructed per part: only whole messages
471 can be forcefully freed from memory. Of course, you can delete()
472 separate parts, which only sets a flag not to write a part again.
473 Furthermore, you may cosider rebuild() to get rit of deleted parts.
474
475 $obj->inGlobalDestruction
476
477 See "Cleanup" in Mail::Reporter
478
481 Error: Cannot include forward source as $include.
482
483 Unknown alternative for the forward(include). Valid choices are "NO",
484 "INLINE", "ATTACH", and "ENCAPSULATE".
485
486 Error: Cannot include reply source as $include.
487
488 Unknown alternative for the "include" option of reply(). Valid choices
489 are "NO", "INLINE", and "ATTACH".
490
491 Error: Method bounce requires To, Cc, or Bcc
492
493 The message bounce() method forwards a received message off to someone
494 else without modification; you must specified it's new destination. If
495 you have the urge not to specify any destination, you probably are
496 looking for reply(). When you wish to modify the content, use for‐
497 ward().
498
499 Error: Method forwardAttach requires a preamble
500
501 Error: Method forwardEncapsulate requires a preamble
502
503 Error: No address to create forwarded to.
504
505 If a forward message is created, a destination address must be speci‐
506 fied.
507
508 Error: No default mailer found to send message.
509
510 The message send() mechanism had not enough information to automati‐
511 cally find a mail transfer agent to sent this message. Specify a
512 mailer explicitly using the "via" options.
513
514 Error: No rebuild rule $name defined.
515
516 Error: Only build() Mail::Message's; they are not in a folder yet
517
518 You may wish to construct a message to be stored in a some kind of
519 folder, but you need to do that in two steps. First, create a normal
520 Mail::Message, and then add it to the folder. During this
521 Mail::Box::addMessage() process, the message will get coerce()-d into
522 the right message type, adding storage information and the like.
523
524 Error: Package $package does not implement $method.
525
526 Fatal error: the specific package (or one of its superclasses) does not
527 implement this method where it should. This message means that some
528 other related classes do implement this method however the class at
529 hand does not. Probably you should investigate this and probably
530 inform the author of the package.
531
532 Error: You cannot destruct message parts, only whole messages
533
534 Message parts can not be destructed per part: only whole messages can
535 be forcefully freed from memory. Consider delete() or rebuild().
536
538 This module is part of Mail-Box distribution version 2.070, built on
539 March 25, 2007. Website: http://perl.overmeer.net/mailbox/
540
542 Copyrights 2001-2007 by Mark Overmeer.For other contributors see
543 ChangeLog.
544
545 This program is free software; you can redistribute it and/or modify it
546 under the same terms as Perl itself. See
547 http://www.perl.com/perl/misc/Artistic.html
548
549
550
551perl v5.8.8 2007-03-25 Mail::Message::Part(3)