Mail::Box::IMAP4::Message(3pm) | User Contributed Perl Documentation | Mail::Box::IMAP4::Message(3pm) |
Mail::Box::IMAP4::Message - one message on a IMAP4 server
Mail::Box::IMAP4::Message is a Mail::Box::Net::Message is a Mail::Box::Message is a Mail::Message is a Mail::Reporter
my $folder = new Mail::Box::IMAP4 ... my $message = $folder->message(10);
A "Mail::Box::IMAP4::Message" represents one message on a IMAP4 server, maintained by a Mail::Box::IMAP4 folder. Each message is stored as separate entity on the server, and maybe temporarily in your program as well.
Extends "DESCRIPTION" in Mail::Box::Net::Message.
Extends "METHODS" in Mail::Box::Net::Message.
Extends "Constructors" in Mail::Box::Net::Message.
-Option --Defined in --Default body Mail::Message undef body_type Mail::Box::Message Mail::Message::Body::Lines cache_body <false> cache_head <false> cache_labels <false> deleted Mail::Message <false> field_type Mail::Message undef folder Mail::Box::Message <required> 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 <false> size Mail::Box::Message undef trace Mail::Reporter 'WARNINGS' trusted Mail::Message <false> unique Mail::Box::Net::Message <unique string> write_labels <true>
Extends "Constructing a message" in Mail::Box::Net::Message.
Extends "The message" in Mail::Box::Net::Message.
Extends "The header" in Mail::Box::Net::Message.
Extends "The body" in Mail::Box::Net::Message.
Extends "Flags" in Mail::Box::Net::Message.
The IMAP protocol defines its own names for the labels, which must be set immediately to inform other IMAP clients which may have the same folder open. But that can be changed with new(write_labels). Some labels are translated to the corresponding IMAP system labels.
Extends "The whole message as text" in Mail::Box::Net::Message.
Extends "Internals" in Mail::Box::Net::Message.
The $imap argument is a Mail::IMAPClient which has the right folder already selected.
Writing changes to the remote folder is not without hassle: IMAP4 (or is it only Mail::IMAPClient doesn't support replacing header or body. Therefore, when either of them change, the whole message is rewritten to the server (which is supported), and the original flagged for deletion.
Extends "Error handling" in Mail::Box::Net::Message.
Extends "Cleanup" in Mail::Box::Net::Message.
Extends "DETAILS" in Mail::Box::Net::Message.
Extends "Structure of a Message" in Mail::Box::Net::Message.
Extends "Message object implementation" in Mail::Box::Net::Message.
Extends "Message class implementation" in Mail::Box::Net::Message.
Extends "Labels" in Mail::Box::Net::Message.
Predefined labels
Extends "Predefined labels" in Mail::Box::Net::Message.
Status and X-Status fields
Extends "Status and X-Status fields" in Mail::Box::Net::Message.
IMAP protocol flags
Labels (or flags) are known to all folder formats, but differ how they are stored. Some folder types use message header lines to keep the labels, other use a separate file. The IMAP protocol does not specify how the labels are kept on the server, but does specify how they are named.
The label names as defined by the IMAP protocol are standardized into the MailBox standard to hide folder differences. The following translations are always performed:
\Seen => seen \Answered => replied \Flagged => flagged \Deleted => deleted \Draft => draft \Recent => NOT old
. Example: of label translations
$imap->message(3)->label(replied => 1, draft => 0);
will result in a IMAP protocol statements like
A003 STORE 4 +FLAGS (\Answered) A003 STORE 4 -FLAGS (\Draft)
Other labels
Of course, your program may be in need for more labels than those provided by the protocol. You can still use these: they stay locally (and are lost when the folder is closed). Some IMAP4 extensions permit more labels than the basic RFC, but that is not yet supported by this implementation.
Caching labels
When you ask for one or more flags of a message more than once, you may improve the overall performance by setting new(cache_labels) to "YES". However, this may cause inconsistencies when multiple clients use the same folder on the IMAP server.
You may also delay the label updates to the server until the folder is closed (or for ever when read-only is required). When Mail::Box::write() or Mail::Box::close() is called, it is decided whether to throw all changes away or write after all.
This module is part of Mail-Box-IMAP4 distribution version 3.007, built on June 13, 2019. Website: http://perl.overmeer.net/CPAN/
Copyrights 2001-2019 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/
2022-12-01 | perl v5.36.0 |