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 => $object
  • body_type => CODE|$class
  • deleted => BOOLEAN
  • field_type => $class
  • folder => $folder
  • from_line => $line β€” this is the $line that kicks off every single message in the file. some people detest this line, bestie, but that's just how things were invented... πŸ’€
  • head => $object
  • head_type => $class
  • labels => \@pairs|\%settings
  • messageId => $id
  • message_id => $id
  • modified => BOOLEAN
  • size => $bytes
  • trusted => 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 with From is 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 with From . 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" in Mail::Box::Message
  • $obj->readFromParser($parser) β€” reads one whole message out of a Mail::Box::File based folder, leading message separator included, no skipping. Improves base, see "Internals" in Mail::Message
  • $obj->readHead( $parser, [$class] ) β€” inherited, see "Internals" in Mail::Message
  • $obj->recursiveRebuildPart($part, %options) β€” inherited, see "Internals" in Mail::Message::Construct::Rebuild
  • $obj->storeBody($body) β€” inherited, see "Internals" in Mail::Message
  • $obj->takeMessageId( [STRING] ) β€” inherited, see "Internals" in Mail::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" in Mail::Message::Construct
  • $obj->notImplemented() β€” inherited, see "Error handling" in Mail::Reporter
  • $any->shortSize( [$value] ) β€” inherited, see "Error handling" in Mail::Message
  • $obj->shortString() β€” inherited, see "Error handling" in Mail::Message

🧹 Cleanup

Extends "Cleanup" in Mail::Box::Message. the part where we tidy up and log off, periodt.

  • $obj->DESTROY() β€” inherited, see "Cleanup" in Mail::Reporter
  • $obj->destruct() β€” inherited, see "Cleanup" in Mail::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 the forward(include). the valid choices are "NO", "INLINE", "ATTACH", and "ENCAPSULATE". cast by forward()
  • Error: No default mailer found to send message. β€” the message send() 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 by send()
  • Error: Unable to read delayed body. β€” cast by loadBody()
  • Error: cannot coerce a $type object into a $me object. β€” cast by coerce()
  • Error: cannot include reply source as $kind. β€” unknown alternative for the "include" option of reply(). valid choices are "NO", "INLINE", and "ATTACH". cast by reply()
  • Error: cannot read message from a $source. β€” cast by read()
  • 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 by notImplemented()
  • Error: coercion starts with some object, not '$type'. β€” cast by coerce()
  • Error: method bounce requires To, Cc, or Bcc. β€” the message bounce() 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 for reply(). when you wish to modify the content, use forward(). cast by bounce()
  • Error: method forwardAttach requires a preamble. β€” cast by forwardAttach()
  • Error: method forwardEncapsulate requires a preamble. β€” cast by forwardEncapsulate()
  • Error: method forwardNo requires a To. β€” cast by forwardNo()
  • Error: method forwardNo requires a body. β€” cast by forwardNo()
  • Error: no rebuild rule $name defined. β€” cast by rebuild()
  • 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 normal Mail::Message, and then add it to the folder. during this Mail::Box::addMessage() process, the message will get coerce()-d into the right message type, adding storage information and the like. cast by build()
  • Error: please install Email::Simple. β€” cast by coerce()
  • Error: please install MIME::Entity. β€” cast by coerce()
  • Error: please install Mail::Internet. β€” cast by coerce()
  • Error: select parts via '$what'? β€” cast by parts()
  • Warning: skipped unknown key '$key' in build. β€” cast by build()

πŸ‘€ 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