NAME
Mail::Message::Part - a part of a message, but a message by itself.
CLASS INHERITANCE
Mail::Message::Part
is a Mail::Message
is a Mail::Reporter
SYNOPSIS
my Mail::Message $message = ...;
if($message->isMultipart) {
my Mail::Message::Part $part;
foreach $part ($message->body->parts) {
$part->print(\*OUT);
my $attachbody = $part->head;
my $attachhead = $part->body;
}
}
DESCRIPTION
A Mail::Message::Part object contains a message which is included in the body of an other message. For instance attachments are parts.
READ Mail::Message FIRST. A part is a special message: it has a reference to its parent message, and will usually not be sub-classed into mail-folder-specific variants.
METHODS
Initiation
- new OPTIONS
-
(Class method) Create a message part.
OPTION DEFAULT body undef body_type 'Mail::Message::Body::Lines' container <obligatory> field_type undef head undef head_type 'Mail::Message::Head::Complete' log 'WARNINGS' messageId undef modified <false> trace 'WARNINGS' trusted <false>
- body => OBJECT
-
See Mail::Message::new(body)
- body_type => CLASS
-
See Mail::Message::new(body_type)
- container => BODY
-
Reference to the parental Mail::Message::Body object where this part is a member of. That object may be a Mail::Message::Body::Multipart or a Mail::Message::Body::Nested.
- field_type => CLASS
-
See Mail::Message::new(field_type)
- head => OBJECT
-
See Mail::Message::new(head)
- head_type => CLASS
-
See Mail::Message::new(head_type)
- log => LEVEL
-
See Mail::Reporter::new(log)
- messageId => STRING
-
See Mail::Message::new(messageId)
- modified => BOOLEAN
-
See Mail::Message::new(modified)
- trace => LEVEL
-
See Mail::Reporter::new(trace)
- trusted => BOOLEAN
-
See Mail::Message::new(trusted)
Constructing a Message
- bounce [RG-OBJECT|OPTIONS]
-
See Mail::Message::Construct::bounce()
- build [MESSAGE|BODY], CONTENT
-
See Mail::Message::Construct::build()
- buildFromBody BODY, CONTAINER, HEADERS
-
(Class method) Shape a message part around a BODY. Bodies have information about their content in them, which is used to construct a header for the message. Next to that, more HEADERS can be specified. No headers are obligatory. No extra headers are fabricated automatically.
Examples:
my $multi = Mail::Message::Body::Multipart->new; my $part = Mail::Message::Part->buildFromBody($body, $multi);
- coerce BODY|MESSAGE, MULTIPART, HEADERS
-
Transforms a BODY or MESSAGE to a real message part. The MULTIPART refers to the parental body.
When ta BODY is specified, extra HEADERS can be supplied as well. Bodies are coerced into message parts by calling buildFromBody(). If you specify a MESSAGE residing in a folder, this message will automatically be cloned.
- forward OPTIONS
-
See Mail::Message::Construct::forward()
- forwardPostlude
-
See Mail::Message::Construct::forwardPostlude()
- forwardPrelude
-
See Mail::Message::Construct::forwardPrelude()
- forwardSubject STRING
-
See Mail::Message::Construct::forwardSubject()
- read FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS
-
See Mail::Message::Construct::read()
-
See Mail::Message::Construct::reply()
- replyPrelude [STRING|FIELD|ADDRESS]
-
See Mail::Message::Construct::replyPrelude()
- replySubject STRING
-
See Mail::Message::Construct::replySubject()
The Message
- clone
-
See Mail::Message::clone()
- container
-
See Mail::Message::container()
- delete
-
Do not print or send this part of the message anymore. See deleted(). The time stamp of the moment of deletion is stored as value. When the same message is deleted more than once, the first time stamp will stay.
Examples:
$message->part(2)->delete; $part->deleted(1); delete $part;
- deleted [BOOLEAN]
-
Set the delete flag for this part of the multipart message body. Without argument, the method returns the same is the isDeleted() method, which is prefered. When a true value is given, delete() is called.
- isDeleted
-
Returns the moment (as the time function returns) when the message part was flagged for deletion, or
undef
when the part is not deleted.Examples:
next if $part->isDeleted; if(my $when = $part->isDeleted) { print scalar localtime $when; }
- isDummy
-
See Mail::Message::isDummy()
- isModified
-
See Mail::Message::isModified()
- isPart
-
See Mail::Message::isPart()
- messageId
-
See Mail::Message::messageId()
- modified [BOOLEAN]
-
See Mail::Message::modified()
- print [FILEHANDLE]
-
See Mail::Message::print()
- printEscapedFrom FILEHANDLE
-
Prints the message part, but all lines which start with 'From ' will get a leading
gt
. See Mail::Message::Body::printEscapedFrom(). - send [MAILER], OPTIONS
-
See Mail::Message::send()
- size
-
See Mail::Message::size()
- toplevel
-
See Mail::Message::toplevel()
- write [FILEHANDLE]
-
See Mail::Message::write()
The Header
Header Shortcuts
- bcc
-
See Mail::Message::bcc()
- cc
-
See Mail::Message::cc()
- date
-
See Mail::Message::date()
- destinations
-
See Mail::Message::destinations()
- from
-
See Mail::Message::from()
- get FIELD
-
See Mail::Message::get()
- guessTimestamp
-
See Mail::Message::guessTimestamp()
- nrLines
-
See Mail::Message::nrLines()
- sender
-
See Mail::Message::sender()
- subject
-
See Mail::Message::subject()
- timestamp
-
See Mail::Message::timestamp()
- to
-
See Mail::Message::to()
The Body
- body [BODY]
-
See Mail::Message::body()
- decoded OPTIONS
-
See Mail::Message::decoded()
- encode OPTIONS
-
See Mail::Message::encode()
- isMultipart
-
See Mail::Message::isMultipart()
- parts ['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER]
-
See Mail::Message::parts()
Access to the Message
- file
-
See Mail::Message::Construct::file()
- lines
-
See Mail::Message::Construct::lines()
- string
-
See Mail::Message::Construct::string()
Labels
- label LABEL [,VALUE [LABEL, VALUE] ]
-
See Mail::Message::label()
- labels
-
See Mail::Message::labels()
- labelsToStatus
-
See Mail::Message::labelsToStatus()
- statusToLabels
-
See Mail::Message::statusToLabels()
Reading and Writing [internals]
- DESTROY
-
See Mail::Message::DESTROY()
- isDelayed
-
See Mail::Message::isDelayed()
- readBody PARSER, HEAD [, BODYTYPE]
-
See Mail::Message::readBody()
- readFromParser PARSER, [BODYTYPE]
-
See Mail::Message::readFromParser()
- readHead PARSER [,CLASS]
-
See Mail::Message::readHead()
- storeBody BODY
-
See Mail::Message::storeBody()
- takeMessageId [STRING]
-
See Mail::Message::takeMessageId()
Logging and Tracing
- defaultTrace [LEVEL, [LEVEL]
-
See Mail::Reporter::defaultTrace()
- errors
-
See Mail::Reporter::errors()
- log [LEVEL [,STRINGS]]
-
See Mail::Reporter::log()
- printStructure [FILEHANDLE][, INDENT]
-
See Mail::Message::Construct::printStructure()
- report [LEVEL]
-
See Mail::Reporter::report()
- reportAll [LEVEL]
-
See Mail::Reporter::reportAll()
- trace [LEVEL]
-
See Mail::Reporter::trace()
- warnings
-
See Mail::Reporter::warnings()
Other Methods
- AUTOLOAD
-
See Mail::Reporter::AUTOLOAD()
- inGlobalDestruction
-
See Mail::Reporter::inGlobalDestruction()
- logPriority LEVEL
-
See Mail::Reporter::logPriority()
- logSettings
-
See Mail::Reporter::logSettings()
- notImplemented
-
See Mail::Reporter::notImplemented()
SEE ALSO
A good start to read is Mail::Box-Overview. More documentation and a mailinglist are available from the project's website at http://perl.overmeer.net/mailbox/.
AUTHOR
Written by Mark Overmeer (mark@overmeer.net) with the help of many. See the ChangeLog for details.
VERSION
This code is beta, version 2.038.
Copyright (c) 2001-2003 by the authors. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.