SYNOPSIS

 my $folder = new Mail::Box::Maildir ...
 my $message = $folder->message(10);

See SYNOPSIS in Mail::Box::Dir::Message

DESCRIPTION

A Mail::Box::Maildir::Message represents one message in an Mail::Box::Maildir folder. Each message is stored in a separate file.

See DESCRIPTION in Mail::Box::Dir::Message

DETAILS

Structure of a Message

See Structure of a Message in Mail::Message

The header

See The header in Mail::Message

The body

See The body in Mail::Message

Message object implementation

See Message object implementation in Mail::Message

Message class implementation

See Message class implementation in Mail::Message

Labels

See Labels in Mail::Message

Predefined labels

See Predefined labels in Mail::Message

Status and X-Status fields

See Status and X-Status fields in Mail::Message

Flags in filename

When new messages arrive on system and have to be stored in a maildir folder, they are put in the new sub-directory of the folder (first created in the tmp sub-directory and then immediately moved to new). The following information was found at http://cr.yp.to/proto/maildir.html.

Each message is written in a separate file. The filename is constructed from the time-of-arrival, a hostname, an unique component, a syntax marker, and flags. For example 1014220791.meteor.42:2,DF. The filename must match:

 my ($time, $unique, $hostname, $info)
    = $filename =~ m!^(\d+)\.(.*)\.(\w+)(\:.*)?$!;
 my ($semantics, $flags)
    = $info =~ m!([12])\,([DFPRST]*)$!;
 my @flags = split //, $flags;

When an application opens the folder, there may be messages in new which are new arival, and messages in cur. The latter are labeled accepted. To move a message from new to cur, you have two options with the same effect:

  $msg->accept;
  $msg->label(accept => 1);

See accept(), label(), Mail::Box::Maildir::new(accept_new), and Mail::Box::Maildir::acceptMessages()

The messages are moved, and their name is immediately extended with flags. An example:

 new/897979431.meteor.42      may become
 cur/897979431.meteor.42:2,FS

The added characters ':2,' refer to the "second state of processing", where the message has been inspected. And the characters (which should be in alphabetic order) mean

 D      => draft
 F      => flagged
 R      => replied  (answered)
 S      => seen
 T      => deleted  (tagged for deletion)

Some maildir clients support

 P      => passed   (resent/forwarded/bounced to someone else)

The flags will immediately change when label() or delete() is used, which differs from other message implementations: maildir is stateless, and should not break when applications crash.