{
    "mode": "perldoc",
    "parameter": "Mail::Box::Maildir::Message",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Mail%3A%3ABox%3A%3AMaildir%3A%3AMessage/json",
    "generated": "2026-06-15T14:54:48Z",
    "synopsis": "my $folder = new Mail::Box::Maildir ...\nmy $message = $folder->message(10);",
    "sections": {
        "NAME": {
            "content": "Mail::Box::Maildir::Message - one message in a Maildir folder\n",
            "subsections": []
        },
        "INHERITANCE": {
            "content": "Mail::Box::Maildir::Message\nis a Mail::Box::Dir::Message\nis a Mail::Box::Message\nis a Mail::Message\nis a Mail::Reporter\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $folder = new Mail::Box::Maildir ...\nmy $message = $folder->message(10);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "A \"Mail::Box::Maildir::Message\" represents one message in an Mail::Box::Maildir folder. Each\nmessage is stored in a separate file.\n\nExtends \"DESCRIPTION\" in Mail::Box::Dir::Message.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Extends \"METHODS\" in Mail::Box::Dir::Message.\n",
            "subsections": [
                {
                    "name": "Constructors",
                    "content": "Extends \"Constructors\" in Mail::Box::Dir::Message.\n\n$obj->clone(%options)\nInherited, see \"Constructors\" in Mail::Message\n\nMail::Box::Maildir::Message->new(%options)\nInherited, see \"METHODS\" in Mail::Box::Dir::Message\n"
                },
                {
                    "name": "Constructing a message",
                    "content": "Extends \"Constructing a message\" in Mail::Box::Dir::Message.\n\n$obj->bounce( [<$rgobject|%options>] )\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Bounce\n\nMail::Box::Maildir::Message->build( [$message|$part|$body], $content )\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Build\n\nMail::Box::Maildir::Message->buildFromBody($body, [$head], $headers)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Build\n\n$obj->forward(%options)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Forward\n\n$obj->forwardAttach(%options)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Forward\n\n$obj->forwardEncapsulate(%options)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Forward\n\n$obj->forwardInline(%options)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Forward\n\n$obj->forwardNo(%options)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Forward\n\n$obj->forwardPostlude()\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Forward\n\n$obj->forwardPrelude()\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Forward\n\n$obj->forwardSubject(STRING)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Forward\n\nMail::Box::Maildir::Message->read($fh|STRING|SCALAR|ARRAY, %options)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Read\n\n$obj->rebuild(%options)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Rebuild\n\n$obj->reply(%options)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Reply\n\n$obj->replyPrelude( [STRING|$field|$address|ARRAY-$of-$things] )\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Reply\n\n$obj->replySubject(STRING)\nMail::Box::Maildir::Message->replySubject(STRING)\nInherited, see \"Constructing a message\" in Mail::Message::Construct::Reply\n"
                },
                {
                    "name": "The message",
                    "content": "Extends \"The message\" in Mail::Box::Dir::Message.\n\n$obj->container()\nInherited, see \"The message\" in Mail::Message\n\n$obj->copyTo($folder, %options)\nInherited, see \"The message\" in Mail::Box::Message\n\n$obj->filename( [$filename] )\nReturns the current filename for this message. If the $filename argument is specified, a new\nfilename will be set. For maildir messages this means that modifications are immediately\nperformed: there will be a rename (move) from the old name to the new name. Labels may\nchange within in the message object as well.\n\n$obj->folder( [$folder] )\nInherited, see \"The message\" in Mail::Box::Message\n\n$obj->isDummy()\nInherited, see \"The message\" in Mail::Message\n\n$obj->isPart()\nInherited, see \"The message\" in Mail::Message\n\n$obj->messageId()\nInherited, see \"The message\" in Mail::Message\n\n$obj->moveTo($folder, %options)\nInherited, see \"The message\" in Mail::Box::Message\n\n$obj->partNumber()\nInherited, see \"The message\" in Mail::Message\n\n$obj->print( [$fh] )\nInherited, see \"The message\" in Mail::Message\n\n$obj->send( [$mailer], %options )\nInherited, see \"The message\" in Mail::Message\n\n$obj->seqnr( [$integer] )\nInherited, see \"The message\" in Mail::Box::Message\n\n$obj->size()\nInherited, see \"The message\" in Mail::Message\n\n$obj->toplevel()\nInherited, see \"The message\" in Mail::Message\n\n$obj->write( [$fh] )\nInherited, see \"The message\" in Mail::Message\n"
                },
                {
                    "name": "The header",
                    "content": "Extends \"The header\" in Mail::Box::Dir::Message.\n\n$obj->bcc()\nInherited, see \"The header\" in Mail::Message\n\n$obj->cc()\nInherited, see \"The header\" in Mail::Message\n\n$obj->date()\nInherited, see \"The header\" in Mail::Message\n\n$obj->destinations()\nInherited, see \"The header\" in Mail::Message\n\n$obj->from()\nInherited, see \"The header\" in Mail::Message\n\n$obj->get($fieldname)\nInherited, see \"The header\" in Mail::Message\n\n$obj->guessTimestamp()\nThe filename of a \"Mail::Box::Maildir::Message\" contains a timestamp. This is a wild guess\nabout the actual time of sending of the message: it is the time of receipt which may be\nseconds to hours off. But is still a good guess... When the message header is not parsed,\nthen this date is used.\n\n$obj->head( [$head] )\nInherited, see \"The header\" in Mail::Message\n\n$obj->nrLines()\nInherited, see \"The header\" in Mail::Message\n\n$obj->sender()\nInherited, see \"The header\" in Mail::Message\n\n$obj->study($fieldname)\nInherited, see \"The header\" in Mail::Message\n\n$obj->subject()\nInherited, see \"The header\" in Mail::Message\n\n$obj->timestamp()\nInherited, see \"The header\" in Mail::Message\n\n$obj->to()\nInherited, see \"The header\" in Mail::Message\n"
                },
                {
                    "name": "The body",
                    "content": "Extends \"The body\" in Mail::Box::Dir::Message.\n\n$obj->body( [$body] )\nInherited, see \"The body\" in Mail::Message\n\n$obj->contentType()\nInherited, see \"The body\" in Mail::Message\n\n$obj->decoded(%options)\nInherited, see \"The body\" in Mail::Message\n\n$obj->encode(%options)\nInherited, see \"The body\" in Mail::Message\n\n$obj->isMultipart()\nInherited, see \"The body\" in Mail::Message\n\n$obj->isNested()\nInherited, see \"The body\" in Mail::Message\n\n$obj->parts( [<'ALL'|'ACTIVE'|'DELETED'|'RECURSE'|$filter>] )\nInherited, see \"The body\" in Mail::Message\n"
                },
                {
                    "name": "Flags",
                    "content": "Extends \"Flags\" in Mail::Box::Dir::Message.\n\n$obj->delete()\nInherited, see \"Flags\" in Mail::Message\n\n$obj->deleted( [BOOLEAN] )\nInherited, see \"Flags\" in Mail::Message\n\n$obj->isDeleted()\nInherited, see \"Flags\" in Mail::Message\n\n$obj->isModified()\nInherited, see \"Flags\" in Mail::Message\n\n$obj->label($label|PAIRS)\nInherited, see \"Flags\" in Mail::Message\n\n$obj->labels()\nInherited, see \"Flags\" in Mail::Message\n\n$obj->labelsToStatus()\nInherited, see \"Flags\" in Mail::Message\n\n$obj->modified( [BOOLEAN] )\nInherited, see \"Flags\" in Mail::Message\n\n$obj->statusToLabels()\nInherited, see \"Flags\" in Mail::Message\n"
                },
                {
                    "name": "The whole message as text",
                    "content": "Extends \"The whole message as text\" in Mail::Box::Dir::Message.\n\n$obj->file()\nInherited, see \"The whole message as text\" in Mail::Message::Construct::Text\n\n$obj->lines()\nInherited, see \"The whole message as text\" in Mail::Message::Construct::Text\n\n$obj->printStructure( [$fh|undef],[$indent] )\nInherited, see \"The whole message as text\" in Mail::Message::Construct::Text\n\n$obj->string()\nInherited, see \"The whole message as text\" in Mail::Message::Construct::Text\n"
                },
                {
                    "name": "Labels",
                    "content": "$obj->labelsToFilename()\nWhen the labels on a message change, this may implicate a change in the message's filename.\nThe change will take place immediately. The new filename (which may be the same as the old\nfilename) is returned. \"undef\" is returned when the rename is required but fails.\n"
                },
                {
                    "name": "Internals",
                    "content": "Extends \"Internals\" in Mail::Box::Dir::Message.\n\n$obj->accept( [BOOLEAN] )\nAccept a message for the folder. This will move it from the \"new\" or \"tmp\" sub-directories\ninto the \"cur\" sub-directory (or back when the BOOLEAN is \"false\"). When you accept an\nalready accepted message, nothing will happen.\n\n$obj->clonedFrom()\nInherited, see \"Internals\" in Mail::Message\n\nMail::Box::Maildir::Message->coerce($message, %options)\nInherited, see \"Internals\" in Mail::Message\n\n$obj->create($filename)\nInherited, see \"Internals\" in Mail::Box::Dir::Message\n\n$obj->diskDelete()\nInherited, see \"Internals\" in Mail::Box::Message\n\n$obj->isDelayed()\nInherited, see \"Internals\" in Mail::Message\n\n$obj->loadBody()\nInherited, see \"Internals\" in Mail::Box::Dir::Message\n\n$obj->loadHead()\nInherited, see \"Internals\" in Mail::Box::Dir::Message\n\n$obj->parser()\nInherited, see \"Internals\" in Mail::Box::Dir::Message\n\n$obj->readBody( $parser, $head, [$bodytype] )\nInherited, see \"Internals\" in Mail::Box::Message\n\n$obj->readFromParser( $parser, [$bodytype] )\nInherited, see \"Internals\" in Mail::Message\n\n$obj->readHead( $parser, [$class] )\nInherited, see \"Internals\" in Mail::Message\n\n$obj->recursiveRebuildPart($part, %options)\nInherited, see \"Internals\" in Mail::Message::Construct::Rebuild\n\n$obj->storeBody($body)\nInherited, see \"Internals\" in Mail::Message\n\n$obj->takeMessageId( [STRING] )\nInherited, see \"Internals\" in Mail::Message\n"
                },
                {
                    "name": "Error handling",
                    "content": "Extends \"Error handling\" in Mail::Box::Dir::Message.\n\n$obj->AUTOLOAD()\nInherited, see \"METHODS\" in Mail::Message::Construct\n\n$obj->addReport($object)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )\nMail::Box::Maildir::Message->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback]\n)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->errors()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->log( [$level, [$strings]] )\nMail::Box::Maildir::Message->log( [$level, [$strings]] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logPriority($level)\nMail::Box::Maildir::Message->logPriority($level)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logSettings()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->notImplemented()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->report( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->reportAll( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->shortSize( [$value] )\nMail::Box::Maildir::Message->shortSize( [$value] )\nInherited, see \"Error handling\" in Mail::Message\n\n$obj->shortString()\nInherited, see \"Error handling\" in Mail::Message\n\n$obj->trace( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->warnings()\nInherited, see \"Error handling\" in Mail::Reporter\n"
                },
                {
                    "name": "Cleanup",
                    "content": "Extends \"Cleanup\" in Mail::Box::Dir::Message.\n\n$obj->DESTROY()\nInherited, see \"Cleanup\" in Mail::Reporter\n\n$obj->destruct()\nInherited, see \"Cleanup\" in Mail::Box::Message\n"
                }
            ]
        },
        "DETAILS": {
            "content": "Extends \"DETAILS\" in Mail::Box::Dir::Message.\n",
            "subsections": [
                {
                    "name": "Structure of a Message",
                    "content": "Extends \"Structure of a Message\" in Mail::Box::Dir::Message.\n"
                },
                {
                    "name": "Message object implementation",
                    "content": "Extends \"Message object implementation\" in Mail::Box::Dir::Message.\n"
                },
                {
                    "name": "Message class implementation",
                    "content": "Extends \"Message class implementation\" in Mail::Box::Dir::Message.\n"
                },
                {
                    "name": "Labels",
                    "content": "Extends \"Labels\" in Mail::Box::Dir::Message.\n\nPredefined labels\nExtends \"Predefined labels\" in Mail::Box::Dir::Message.\n\nStatus and X-Status fields\nExtends \"Status and X-Status fields\" in Mail::Box::Dir::Message.\n\nFlags in filename\nWhen new messages arrive on system and have to be stored in a maildir folder, they are put in\nthe \"new\" sub-directory of the folder (first created in the \"tmp\" sub-directory and then\nimmediately moved to \"new\"). The following information was found at\n<http://cr.yp.to/proto/maildir.html>.\n\nEach message is written in a separate file. The filename is constructed from the\ntime-of-arrival, a hostname, an unique component, a syntax marker, and flags. For example\n\"1014220791.meteor.42:2,DF\". The filename must match:\n\nmy ($time, $unique, $hostname, $info)\n= $filename =~ m!^(\\d+)\\.(.*)\\.(\\w+)(\\:.*)?$!;\nmy ($semantics, $flags)\n= $info =~ m!([12])\\,([DFPRST]*)$!;\nmy @flags = split //, $flags;\n\nWhen an application opens the folder, there may be messages in \"new\" which are new arival, and\nmessages in \"cur\". The latter are labeled \"accepted\". To move a message from \"new\" to \"cur\", you\nhave two options with the same effect:\n\n$msg->accept;\n$msg->label(accept => 1);\n\nSee accept(), label(), Mail::Box::Maildir::new(acceptnew), and\nMail::Box::Maildir::acceptMessages()\n\nThe messages are moved, and their name is immediately extended with flags. An example:\n\nnew/897979431.meteor.42      may become\ncur/897979431.meteor.42:2,FS\n\nThe added characters ':2,' refer to the \"second state of processing\", where the message has been\ninspected. And the characters (which should be in alphabetic order) mean\n\nD      => draft\nF      => flagged\nR      => replied  (answered)\nS      => seen\nT      => deleted  (tagged for deletion)\n\nSome maildir clients support P => passed (resent/forwarded/bounced to someone else)\n\nThe flags will immediately change when label() or delete() is used, which differs from other\nmessage implementations: maildir is stateless, and should not break when applications crash.\n"
                }
            ]
        },
        "DIAGNOSTICS": {
            "content": "Error: Cannot coerce a $class object into a $class object\nError: Cannot create parser for $filename.\nFor some reason (the previous message have told you already) it was not possible to create a\nmessage parser for the specified filename.\n\nError: Cannot include forward source as $include.\nUnknown alternative for the forward(include). Valid choices are \"NO\", \"INLINE\", \"ATTACH\",\nand \"ENCAPSULATE\".\n\nError: Cannot include reply source as $include.\nUnknown alternative for the \"include\" option of reply(). Valid choices are \"NO\", \"INLINE\",\nand \"ATTACH\".\n\nError: Cannot write message to $filename: $!\nWhen a modified or new message is written to disk, it is first written to a temporary file\nin the folder directory. For some reason, it is impossible to create this file.\n\nError: Failed to move $new to $filename: $!\nWhen a modified or new message is written to disk, it is first written to a temporary file\nin the folder directory. Then, the new file is moved to replace the existing file.\nApparently, the latter fails.\n\nError: Method bounce requires To, Cc, or Bcc\nThe message bounce() method forwards a received message off to someone else without\nmodification; you must specified it's new destination. If you have the urge not to specify\nany destination, you probably are looking for reply(). When you wish to modify the content,\nuse forward().\n\nError: Method forwardAttach requires a preamble\nError: Method forwardEncapsulate requires a preamble\nError: No address to create forwarded to.\nIf a forward message is created, a destination address must be specified.\n\nError: No default mailer found to send message.\nThe message send() mechanism had not enough information to automatically find a mail\ntransfer agent to sent this message. Specify a mailer explicitly using the \"via\" options.\n\nError: No rebuild rule $name defined.\nError: Only build() Mail::Message's; they are not in a folder yet\nYou may wish to construct a message to be stored in a some kind of folder, but you need to\ndo that in two steps. First, create a normal Mail::Message, and then add it to the folder.\nDuring this Mail::Box::addMessage() process, the message will get coerce()-d into the right\nmessage type, adding storage information and the like.\n\nError: Package $package does not implement $method.\nFatal error: the specific package (or one of its superclasses) does not implement this\nmethod where it should. This message means that some other related classes do implement this\nmethod however the class at hand does not. Probably you should investigate this and probably\ninform the author of the package.\n\nError: Unable to read delayed body.\nFor some reason, the header of the message could be read, but the body cannot. Probably the\nfile has disappeared or the permissions were changed during the progress of the program.\n\nError: Unable to read delayed head.\nMail::Box tries to be *lazy* with respect to parsing messages. When a directory organized\nfolder is opened, only the filenames of messages are collected. At first use, the messages\nare read from their file. Apperently, a message is used for the first time here, but has\ndisappeared or is unreadible for some other reason.\n\nError: coercion starts with some object\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "This module is part of Mail-Box distribution version 3.009, built on August 18, 2020. Website:\nhttp://perl.overmeer.net/CPAN/\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Copyrights 2001-2020 by [Mark Overmeer]. For other contributors see ChangeLog.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://dev.perl.org/licenses/\n",
            "subsections": []
        }
    },
    "summary": "Mail::Box::Maildir::Message - one message in a Maildir folder",
    "flags": [],
    "examples": [],
    "see_also": []
}