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 another 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
34       Extends "DESCRIPTION" in Mail::Message.
35

METHODS

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

DETAILS

411       Extends "DETAILS" in Mail::Message.
412

DIAGNOSTICS

414       Error: Cannot include forward source as $include.
415           Unknown alternative for the forward(include).  Valid choices are
416           "NO", "INLINE", "ATTACH", and "ENCAPSULATE".
417
418       Error: Cannot include reply source as $include.
419           Unknown alternative for the "include" option of reply().  Valid
420           choices are "NO", "INLINE", and "ATTACH".
421
422       Error: Method bounce requires To, Cc, or Bcc
423           The message bounce() method forwards a received message off to
424           someone else without modification; you must specified it's new
425           destination.  If you have the urge not to specify any destination,
426           you probably are looking for reply(). When you wish to modify the
427           content, use forward().
428
429       Error: Method forwardAttach requires a preamble
430       Error: Method forwardEncapsulate requires a preamble
431       Error: No address to create forwarded to.
432           If a forward message is created, a destination address must be
433           specified.
434
435       Error: No default mailer found to send message.
436           The message send() mechanism had not enough information to
437           automatically find a mail transfer agent to sent this message.
438           Specify a mailer explicitly using the "via" options.
439
440       Error: No rebuild rule $name defined.
441       Error: Only build() Mail::Message's; they are not in a folder yet
442           You may wish to construct a message to be stored in a some kind of
443           folder, but you need to do that in two steps.  First, create a
444           normal Mail::Message, and then add it to the folder.  During this
445           Mail::Box::addMessage() process, the message will get coerce()-d
446           into the right message type, adding storage information and the
447           like.
448
449       Error: Package $package does not implement $method.
450           Fatal error: the specific package (or one of its superclasses) does
451           not implement this method where it should. This message means that
452           some other related classes do implement this method however the
453           class at hand does not.  Probably you should investigate this and
454           probably inform the author of the package.
455
456       Error: You cannot destruct message parts, only whole messages
457           Message parts can not be destructed per part: only whole messages
458           can be forcefully freed from memory. Consider delete() or
459           rebuild().
460

SEE ALSO

462       This module is part of Mail-Message distribution version 3.012, built
463       on February 11, 2022. Website: http://perl.overmeer.net/CPAN/
464

LICENSE

466       Copyrights 2001-2022 by [Mark Overmeer <markov@cpan.org>]. For other
467       contributors see ChangeLog.
468
469       This program is free software; you can redistribute it and/or modify it
470       under the same terms as Perl itself.  See http://dev.perl.org/licenses/
471
472
473
474perl v5.36.0                      2022-07-22            Mail::Message::Part(3)
Impressum