=encoding utf8 =head1 NAME Mail::Box::Message - manage one message within a mail-folder =head1 INHERITANCE Mail::Box::Message is a Mail::Message is a Mail::Reporter Mail::Box::Message is extended by Mail::Box::Dir::Message Mail::Box::File::Message Mail::Box::Message::Destructed Mail::Box::Net::Message =head1 SYNOPSIS # Usually these message objects are created indirectly use Mail::Box::Manager; my $manager = Mail::Box::Manager->new; my $folder = $manager->open(folder => 'Mail/Drafts'); my $msg = $folder->message(1); $msg->delete; $msg->size; # and much more =head1 DESCRIPTION These pages do only describe methods which relate to folders. If you access the knowledge of a message, then read L. During its life, a message will pass through certain stages. These stages were introduced to reduce the access-time to the folder. Changing from stage, the message's body and head objects may change. Extends L<"DESCRIPTION" in Mail::Message|Mail::Message/"DESCRIPTION">. =head1 METHODS Extends L<"METHODS" in Mail::Message|Mail::Message/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message|Mail::Message/"Constructors">. =over 4 =item $obj-EB(%options) Inherited, see L =item Mail::Box::Message-EB(%options) -Option --Defined in --Default body Mail::Message undef body_type deleted Mail::Message field_type Mail::Message undef folder head Mail::Message undef head_type Mail::Message Mail::Message::Head::Complete labels Mail::Message {} log Mail::Reporter 'WARNINGS' messageId Mail::Message undef modified Mail::Message size undef trace Mail::Reporter 'WARNINGS' trusted Mail::Message =over 2 =item body => OBJECT =item body_type => CODE|CLASS If the body of a message is used delay-loaded, the message must what type of message to become when it finally gets parsed. The folder which is delaying the load must specify the algorithm to determine that type. =item deleted => BOOLEAN =item field_type => CLASS =item folder => FOLDER The folder where this message appeared in. The argument is an instance of (a sub-class of) a L. =item head => OBJECT =item head_type => CLASS =item labels => ARRAY|HASH =item log => LEVEL =item messageId => STRING =item modified => BOOLEAN =item size => INTEGER The size of the message, which includes head and body, but without the message separators which may be used by the folder type. =item trace => LEVEL =item trusted => BOOLEAN =back =back =head2 Constructing a message Extends L<"Constructing a message" in Mail::Message|Mail::Message/"Constructing a message">. =over 4 =item $obj-EB( [<$rg_object|%options>] ) Inherited, see L =item Mail::Box::Message-EB( [$message|$part|$body], $content ) Inherited, see L =item Mail::Box::Message-EB($body, [$head], $headers) Inherited, see L =item $obj-EB(%options) Inherited, see L =item $obj-EB(%options) Inherited, see L =item $obj-EB(%options) Inherited, see L =item $obj-EB(%options) Inherited, see L =item $obj-EB(%options) Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB(STRING) Inherited, see L =item Mail::Box::Message-EB($fh|STRING|SCALAR|ARRAY, %options) Inherited, see L =item $obj-EB(%options) Inherited, see L =item $obj-EB(%options) Inherited, see L =item $obj-EB( [STRING|$field|$address|ARRAY-$of-$things] ) Inherited, see L =item $obj-EB(STRING) =item Mail::Box::Message-EB(STRING) Inherited, see L =back =head2 The message Extends L<"The message" in Mail::Message|Mail::Message/"The message">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB($folder, %options) Copy the message to the indicated opened $folder, without deleting the original. The coerced message (the clone in the destination folder) is returned. -Option --Default shallow shallow_body shallow_head share =over 2 =item shallow => BOOLEAN Used for L. =item shallow_body => BOOLEAN Used for L. =item shallow_head => BOOLEAN Used for L. =item share => BOOLEAN Try to share the physical storage of the message between the two folders. Sometimes, they even may be of different types. When not possible, this options will be silently ignored. =back example: my $draft = $mgr->open(folder => 'Draft'); $message->copyTo($draft, share => 1); =item $obj-EB( [$folder] ) In with folder did we detect this message/dummy? This is a reference to the folder-object. =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB($folder, %options) Move the message from this folder to the $folder specified. This will create a copy using L first. Then, this original message is flagged to get deleted. So until the source folder is closed, two copies of the message may stay in memory. The newly created message clone (part of the destination folder) is returned. All %options are passed to L -Option --Default shallow_body share =over 2 =item shallow_body => BOOLEAN Only create a shallow body, which means that the header can not be reused. A message can therefore not be shared in storage unless explicitly stated. =item share => BOOLEAN When there is a chance that the original message can be undeleted, then this must be set to false. Otherwise a shallow clone will be made, which will share the header which can be modified in the undeleted message. =back example: of moving a message my $trash = Mail::Box::Mbox->new(folder => 'trash'); my $t = $msg->moveTo($trash); is equivalent to my $t = $msg->copyTo($trash, share => 1); $msg->delete; =item $obj-EB() Inherited, see L =item $obj-EB( [$fh] ) Inherited, see L =item $obj-EB( [$mailer], %options ) Inherited, see L =item $obj-EB( [$integer] ) Get the number of this message is the current folder. It starts counting from zero. Do not change the number. =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB( [$fh] ) Inherited, see L =back =head2 The header Extends L<"The header" in Mail::Message|Mail::Message/"The header">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB($fieldname) Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB( [$head] ) Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB($fieldname) Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =back =head2 The body Extends L<"The body" in Mail::Message|Mail::Message/"The body">. =over 4 =item $obj-EB( [$body] ) Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB(%options) Inherited, see L =item $obj-EB(%options) Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB( [<'ALL'|'ACTIVE'|'DELETED'|'RECURSE'|$filter>] ) Inherited, see L =back =head2 Flags Extends L<"Flags" in Mail::Message|Mail::Message/"Flags">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB( [BOOLEAN] ) Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB