Mail::...essage(3pm)
π NAME π
Mail::Box::File::Message β one message in a Mbox folder π
oh and real quick, the manual-name vibe check: this page is Mail::...essage(3pm), filed under User Contributed Perl Documentation. iykyk β¨
π INHERITANCE π
bestie the family tree is giving dynasty:
Mail::Box::File::Message
is a Mail::Box::Message
is a Mail::Message
is a Mail::Reporter
Mail::Box::File::Message is extended by
Mail::Box::Mbox::Message
so it's a Mail::Box::Message, which is a Mail::Message, which is a Mail::Reporter. and Mail::Box::Mbox::Message extends it. generational wealth, honestly π
β¨ SYNOPSIS β¨
the whole plot in two lines, no cap:
my $folder = new Mail::Box::File folder => $ENV{MAIL}, ...;
my $message = $folder->message(0);
π¦ DESCRIPTION π¦
okay so this class maintains one single message inside a file-based folder β and by "file-based" we mean any Mail::Box::File extension. that's the whole job. main character energy for one message π
Extends "DESCRIPTION" in Mail::Box::Message.
π METHODS π
Extends "METHODS" in Mail::Box::Message.
π Constructors π
Extends "Constructors" in Mail::Box::Message.
$obj->clone(%options)β Inherited, see "Constructors" in Mail::Message$class->new(%options)β messages in file-based folders use these options when you create them. Improves base, see "Constructors" in Mail::Reporter.
here's the full lineup, bestie β Option, where it's Defined, and its Default, all three columns accounted for:
-Option --Defined in --Default
body Mail::Message undef
body_type Mail::Box::Message <from folder>
deleted Mail::Message false
field_type Mail::Message undef
folder Mail::Box::Message <required>
from_line undef
head Mail::Message undef
head_type Mail::Message Mail::Message::Head::Complete
labels Mail::Message +{}
messageId Mail::Message undef
message_id Mail::Message undef
modified Mail::Message false
size Mail::Box::Message undef
trusted Mail::Message false
and one by one now, bc we don't skip anyone in this house π«Ά
body=>$objectbody_type=>CODE|$classdeleted=>BOOLEANfield_type=>$classfolder=>$folderfrom_line=>$lineβ this is the$linethat kicks off every single message in the file. some people detest this line, bestie, but that's just how things were invented... πhead=>$objecthead_type=>$classlabels=>\@pairs|\%settingsmessageId=>$idmessage_id=>$idmodified=>BOOLEANsize=>$bytestrusted=>BOOLEAN
πΈ Attributes πΈ
Extends "Attributes" in Mail::Box::Message.
$obj->bodyType()β Inherited, see "Attributes" in Mail::Message$obj->fieldType()β Inherited, see "Attributes" in Mail::Message$obj->folder( [$folder] )β Inherited, see "Attributes" in Mail::Box::Message$obj->fromLine( [$line] )β okay so many people detest file-style folders because they shove all the messages into one single file, and the line that starts withFromis what leads the header. if we receive a message from a file-based folder, we store that line. if we write to such a file but there's no such line stored, then we try to generate one. periodt.
and if $line gets provided? then the starting line is set to this value. π
$obj->headType()β Inherited, see "Attributes" in Mail::Message$obj->messageId()β Inherited, see "Attributes" in Mail::Message$obj->seqnr( [$integer] )β Inherited, see "Attributes" in Mail::Box::Message
π§ Constructing a message π§
Extends "Constructing a message" in Mail::Box::Message.
$obj->bounce( [<$rg_object|%options>] )β Inherited, see "Constructing a message" in Mail::Message::Construct::Bounce$class->build( [$message|$part|$body], @fields, %options )β Inherited, see "Constructing a message" in Mail::Message::Construct::Build$class->buildFromBody($body, [$head], $headers)β Inherited, see "Constructing a message" in Mail::Message::Construct::Build$obj->forward(%options)β Inherited, see "Constructing a message" in Mail::Message::Construct::Forward$obj->forwardAttach(%options)β Inherited, see "Constructing a message" in Mail::Message::Construct::Forward$obj->forwardEncapsulate(%options)β Inherited, see "Constructing a message" in Mail::Message::Construct::Forward$obj->forwardInline(%options)β Inherited, see "Constructing a message" in Mail::Message::Construct::Forward$obj->forwardNo(%options)β Inherited, see "Constructing a message" in Mail::Message::Construct::Forward$obj->forwardPostlude()β Inherited, see "Constructing a message" in Mail::Message::Construct::Forward$obj->forwardPrelude()β Inherited, see "Constructing a message" in Mail::Message::Construct::Forward$obj->forwardSubject(STRING)β Inherited, see "Constructing a message" in Mail::Message::Construct::Forward$class->read($fh|$text|\$text|\@lines, %options)β Inherited, see "Constructing a message" in Mail::Message::Construct::Read$obj->rebuild(%options)β Inherited, see "Constructing a message" in Mail::Message::Construct::Rebuild$obj->reply(%options)β Inherited, see "Constructing a message" in Mail::Message::Construct::Reply$obj->replyPrelude( [STRING|$field|$address|\@addrs|\@fields] )β Inherited, see "Constructing a message" in Mail::Message::Construct::Reply$any->replySubject(STRING)β Inherited, see "Constructing a message" in Mail::Message::Construct::Reply
π The message π
Extends "The message" in Mail::Box::Message.
$obj->container()β Inherited, see "The message" in Mail::Message$obj->copyTo($folder, %options)β Inherited, see "The message" in Mail::Box::Message$obj->endsOnNewline()β Inherited, see "The message" in Mail::Message$obj->escapedBody()β Mbox folders hold multiple messages in one file and use a separator line to keep them apart. typically those lines start withFrom. lines inside the message could interfere with that separator, so they should be translated. β¨
this method returns the escaped text of the body as a reference.
$obj->isDummy()β Inherited, see "The message" in Mail::Message$obj->isPart()β Inherited, see "The message" in Mail::Message$obj->moveTo($folder, %options)β Inherited, see "The message" in Mail::Box::Message$obj->partNumber()β Inherited, see "The message" in Mail::Message$obj->print( [$fh] )β Inherited, see "The message" in Mail::Message$obj->send( [$mailer], %options )β Inherited, see "The message" in Mail::Message$obj->size()β Inherited, see "The message" in Mail::Message$obj->toplevel()β Inherited, see "The message" in Mail::Message$obj->write( [$fh] )β writes one message out to a file handle. it's the message including the leading'From 'line and the trailing blank. heads up tho: the From-line may interfere with lines in the body, and those lines get escaped with an extra'>'. Improves base, see "The message" in Mail::Message.
Β» example:
$msg->write(\*FILE); # print the message with encaps to FILE
$msg->write; # message with encaps to selected filehandle
$msg->print(\*FILE); # the message without encaps.
π The header π
Extends "The header" in Mail::Box::Message.
$obj->bcc()β Inherited, see "The header" in Mail::Message$obj->cc()β Inherited, see "The header" in Mail::Message$obj->date()β Inherited, see "The header" in Mail::Message$obj->destinations()β Inherited, see "The header" in Mail::Message$obj->from()β Inherited, see "The header" in Mail::Message$obj->get($fieldname)β Inherited, see "The header" in Mail::Message$obj->guessTimestamp()β Inherited, see "The header" in Mail::Message$obj->head( [$head] )β Inherited, see "The header" in Mail::Message$obj->nrLines()β Inherited, see "The header" in Mail::Message$obj->sender()β Inherited, see "The header" in Mail::Message$obj->study($fieldname)β Inherited, see "The header" in Mail::Message$obj->subject()β Inherited, see "The header" in Mail::Message$obj->timestamp()β Inherited, see "The header" in Mail::Message$obj->to()β Inherited, see "The header" in Mail::Message
π¦ The body π¦
Extends "The body" in Mail::Box::Message.
$obj->body( [$body] )β Inherited, see "The body" in Mail::Message$obj->contentType()β Inherited, see "The body" in Mail::Message$obj->decoded(%options)β Inherited, see "The body" in Mail::Message$obj->encode(%options)β Inherited, see "The body" in Mail::Message$obj->isMultipart()β Inherited, see "The body" in Mail::Message$obj->isNested()β Inherited, see "The body" in Mail::Message$obj->parts( [<'ALL'|'ACTIVE'|'DELETED'|'RECURSE'|$filter>] )β Inherited, see "The body" in Mail::Message
π Flags π
Extends "Flags" in Mail::Box::Message.
$obj->delete()β Inherited, see "Flags" in Mail::Message$obj->deleted( [BOOLEAN] )β Inherited, see "Flags" in Mail::Message$obj->isDeleted()β Inherited, see "Flags" in Mail::Message$obj->isModified()β Inherited, see "Flags" in Mail::Message$obj->label($label|PAIRS)β Inherited, see "Flags" in Mail::Message$obj->labels()β Inherited, see "Flags" in Mail::Message$obj->labelsToStatus()β Inherited, see "Flags" in Mail::Message$obj->modified( [BOOLEAN] )β Inherited, see "Flags" in Mail::Message$obj->statusToLabels()β Inherited, see "Flags" in Mail::Message
π The whole message as text π
Extends "The whole message as text" in Mail::Box::Message.
$obj->file()β Inherited, see "The whole message as text" in Mail::Message::Construct::Text$obj->lines()β Inherited, see "The whole message as text" in Mail::Message::Construct::Text$obj->printStructure( [$fh|undef],[$indent] )β Inherited, see "The whole message as text" in Mail::Message::Construct::Text$obj->string()β Inherited, see "The whole message as text" in Mail::Message::Construct::Text
π Internals π
Extends "Internals" in Mail::Box::Message.
$obj->clonedFrom()β Inherited, see "Internals" in Mail::Message$class->coerce($message, %options)β Inherited, see "Internals" in Mail::Message$obj->diskDelete()β Inherited, see "Internals" in Mail::Box::Message$obj->fileLocation()β returns the location of the whole message, from-line included. in LIST context you get both the begin and the end back. in SCALAR context, only the begin gets passed back.$obj->isDelayed()β Inherited, see "Internals" in Mail::Message$obj->isTrusted()β Inherited, see "Internals" in Mail::Message$obj->loadBody()$obj->moveLocation($distance)β the message gets relocated inside the file, shifted over by $distance bytes. And bestie, when you set a new location, it updates the matching info in both the header and the body. everything stays in sync, no crumbs left. π«$obj->readBody( $parser, $head, [$bodytype] )β inherited, see "Internals" inMail::Box::Message$obj->readFromParser($parser)β reads one whole message out of aMail::Box::Filebased folder, leading message separator included, no skipping. Improves base, see "Internals" inMail::Message$obj->readHead( $parser, [$class] )β inherited, see "Internals" inMail::Message$obj->recursiveRebuildPart($part, %options)β inherited, see "Internals" inMail::Message::Construct::Rebuild$obj->storeBody($body)β inherited, see "Internals" inMail::Message$obj->takeMessageId( [STRING] )β inherited, see "Internals" inMail::Message
π Error handling (but make it cute)
Extends "Error handling" in Mail::Box::Message. so this is the family drama part of the module, inherited straight down the line.
$obj->AUTOLOAD()β inherited, see "METHODS" inMail::Message::Construct$obj->notImplemented()β inherited, see "Error handling" inMail::Reporter$any->shortSize( [$value] )β inherited, see "Error handling" inMail::Message$obj->shortString()β inherited, see "Error handling" inMail::Message
π§Ή Cleanup
Extends "Cleanup" in Mail::Box::Message. the part where we tidy up and log off, periodt.
$obj->DESTROY()β inherited, see "Cleanup" inMail::Reporter$obj->destruct()β inherited, see "Cleanup" inMail::Box::Message
π DETAILS π
Extends "DETAILS" in Mail::Box::Message. yeah that's literally it, it's giving inheritance and nothing else. go read the parent's tea. π«
π DIAGNOSTICS π
this is the part where the module yells at you. buckle up bestie, we're going through every single one. π¨
Error: Cannot include forward source as $kind.β unknown alternative for theforward(include). the valid choices are"NO","INLINE","ATTACH", and"ENCAPSULATE". cast byforward()Error: No default mailer found to send message.β the messagesend()mechanism didn't have enough info to auto-find a mail transfer agent to send this message. so specify a mailer explicitly using the"via"options. cast bysend()Error: Unable to read delayed body.β cast byloadBody()Error: cannot coerce a $type object into a $me object.β cast bycoerce()Error: cannot include reply source as $kind.β unknown alternative for the"include"option ofreply(). valid choices are"NO","INLINE", and"ATTACH". cast byreply()Error: cannot read message from a $source.β cast byread()Error: class $package does not implement method $method.β fatal error: the specific$package(or one of its superclasses) does not implement this method where it should. this message means some other related classes do implement this method, but the class at hand does not. probably you should investigate this, and probably inform the author of the package. cast bynotImplemented()Error: coercion starts with some object, not '$type'.β cast bycoerce()Error: method bounce requires To, Cc, or Bcc.β the messagebounce()method forwards a received message off to someone else without modification, so you must specify its new destination. if you have the urge not to specify any destination, you're probably looking forreply(). when you wish to modify the content, useforward(). cast bybounce()Error: method forwardAttach requires a preamble.β cast byforwardAttach()Error: method forwardEncapsulate requires a preamble.β cast byforwardEncapsulate()Error: method forwardNo requires a To.β cast byforwardNo()Error: method forwardNo requires a body.β cast byforwardNo()Error: no rebuild rule $name defined.β cast byrebuild()Error: only build() Mail::Message's; they are not in a folder yet.β you may wish to construct a message to be stored in some kind of folder, but you gotta do that in two steps. first, create a normalMail::Message, and then add it to the folder. during thisMail::Box::addMessage()process, the message will getcoerce()-d into the right message type, adding storage information and the like. cast bybuild()Error: please install Email::Simple.β cast bycoerce()Error: please install MIME::Entity.β cast bycoerce()Error: please install Mail::Internet.β cast bycoerce()Error: select parts via '$what'?β cast byparts()Warning: skipped unknown key '$key' in build.β cast bybuild()
π SEE ALSO π
this module is part of Mail-Box version 4.02, built on April 10, 2026.
Website: http://perl.overmeer.net/CPAN/
π LICENSE π
for contributors see file ChangeLog.
this software is copyright (c) 2001-2026 by Mark Overmeer.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay and legal, the best combo. π
and that's a wrap on part two, bestie!! π source was perl v5.40.1, page dated 2026-05-09 β iconic, no cap, fr fr. now go read the parent docs and hydrate. π
β¨π¦
π¦ where this page comes from
- ubuntu stonking: libmail-box-perl 4.02-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms