Mail::...essage(3pm)

πŸ’Œ NAME

okay so bestie, Mail::Box::MH::Message β€” that's one message in an MH-folder, periodt πŸ’…


🧬 INHERITANCE

the way this class is literally standing on so many shoulders:

Mail::Box::MH::Message
  is a Mail::Box::Dir::Message
  is a Mail::Box::Message
  is a Mail::Message
  is a Mail::Reporter

it's giving legacy, it's giving lineage, it's giving "my ancestors are iconic" ✨


🌸 SYNOPSIS

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

that's it. that's the vibe. you grab a folder, you grab message number 10, boom πŸŽ€


✨ DESCRIPTION

a Mail::Box::MH::Message represents one message in an Mail::Box::MH folder. every single message gets its own separate file β€” that's how all the Mail::Box::Dir folder types roll, no cap. πŸ—‚οΈ

extends "DESCRIPTION" in Mail::Box::Dir::Message.


πŸ› οΈ METHODS

extends "METHODS" in Mail::Box::Dir::Message.

🍼 Constructors

extends "Constructors" in Mail::Box::Dir::Message.

  • $obj->clone(%options) β€” inherited, see "Constructors" in Mail::Message
  • $class->new(%options) β€” inherited, see "Constructors" in Mail::Box::Dir::Message

🏷️ Attributes

extends "Attributes" in Mail::Box::Dir::Message.

  • $obj->bodyType() β€” inherited, see "Attributes" in Mail::Message
  • $obj->fieldType() β€” inherited, see "Attributes" in Mail::Message
  • $obj->filename( [$filename] ) β€” inherited, see "Attributes" in Mail::Box::Dir::Message
  • $obj->fixHeader() β€” inherited, see "Attributes" in Mail::Box::Dir::Message
  • $obj->folder( [$folder] ) β€” inherited, see "Attributes" in Mail::Box::Message
  • $obj->headType() β€” inherited, see "Attributes" in Mail::Message
  • $obj->messageId() β€” inherited, see "Attributes" in Mail::Message
  • $obj->seqnr( [$integer] ) β€” the order of this message in the folder, counted from zero. do not change the number (unless you truly understand the implications, bestie β€” fr fr). ⚠️
⚠️ WARNING: this sequence number has nothing to do with the message's filename, which in case of MH folders are also numbers! like, chaos. πŸ™ˆ if you need that one, use the File::Basename subroutine basename of the filename.

establishes a base, see "Attributes" in Mail::Box::Message.

πŸ’Œ Constructing a message

extends "Constructing a message" in Mail::Box::Dir::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::Dir::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->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] ) β€” inherited, see "The message" in Mail::Message

πŸ“‹ The header

extends "The header" in Mail::Box::Dir::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::Dir::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::Dir::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::Dir::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::Dir::Message.

  • $obj->clonedFrom() β€” inherited, see "Internals" in Mail::Message
  • $class->coerce($message, %options) β€” inherited, see "Internals" in Mail::Message
  • $obj->create($filename) β€” inherited, see "Internals" in Mail::Box::Dir::Message
  • $obj->diskDelete() β€” inherited, see "Internals" in Mail::Box::Message
  • $obj->isDelayed() β€” inherited, see "Internals" in Mail::Message
  • $obj->isTrusted() β€” inherited, see "Internals" in Mail::Message
  • $obj->loadBody() β€” inherited, see "Internals" in Mail::Box::Dir::Message
  • $obj->loadHead() β€” inherited, see "Internals" in Mail::Box::Dir::Message
  • $obj->parser() β€” inherited, see "Internals" in Mail::Box::Dir::Message
  • $obj->readBody( $parser, $head, [$bodytype] ) β€” inherited, see "Internals" in Mail::Box::Message
  • $obj->readFromParser( $parser, [$bodytype] ) β€” inherited, 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

extends "Error handling" in Mail::Box::Dir::Message.

  • $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::Dir::Message.

  • $obj->DESTROY() β€” inherited, see "Cleanup" in Mail::Reporter
  • $obj->destruct() β€” inherited, see "Cleanup" in Mail::Box::Message

✨ DETAILS ✨

Okay bestie, this part is basically the "everything that's inherited from the ancestor class, plus the spicy bits" section πŸ’…

Extends "DETAILS" in Mail::Box::Dir::Message.

🌸 Structure of a Message 🌸

Extends "Structure of a Message" in Mail::Box::Dir::Message.

πŸ¦‹ Message object implementation πŸ¦‹

Extends "Message object implementation" in Mail::Box::Dir::Message.

πŸ’œ Message class implementation πŸ’œ

Extends "Message class implementation" in Mail::Box::Dir::Message.

πŸŽ€ Labels πŸŽ€

Extends "Labels" in Mail::Box::Dir::Message.

⭐ Predefined labels ⭐

Extends "Predefined labels" in Mail::Box::Dir::Message.

🧚 Status and X-Status fields 🧚

Extends "Status and X-Status fields" in Mail::Box::Dir::Message.

πŸ“ The .mh_sequences file πŸ“

So like, the file that holds the labels is normally called .mh_sequences (the way that name is so specific, love that for us). The MH messages are numbered starting from 1. Here's some example content for .mh_sequences:

cur: 93
unseen: 32 35-56 67-80

Now, to generalize labels across messages, two of them get special treatment:

  • cur

The cur tells you the number of the message where the user dipped out of reading this folder's mail at their last access. Internally in these modules it's referred to as the label current.

  • unseen

unseen lists which messages were never read, bestie. And honestly? This must be a mistake in the design of MH β€” it is highkey a source of confusion. People should never use labels with a negation in the name, periodt:

if($seen)           if(!$unseen)    #yuk!
if(!$seen)          if($unseen)
unless($seen)       unless($unseen) #yuk!

So yeah: the label unseen gets translated into seen for internal use. Iconic fix, truly. πŸ’…


πŸ’€ DIAGNOSTICS πŸ’€

Not me listing every single one of these, but here we go, no skips, no cap.

  • Error: Cannot include forward source as $kind.

Unknown alternative for the forward(include). Valid choices are "NO", "INLINE", "ATTACH", and "ENCAPSULATE". Cast by forward()

  • Error: No default mailer found to send message.

The message send() mechanism did not have enough info to automatically find a mail transfer agent to send this message. Specify a mailer explicitly using the "via" options. Cast by send()

  • 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()

  • Fault: cannot write message to $file: $!

When a modified or new message is written to disk, it is first written to a temporary file in the folder directory. For some reason, it is impossible to create this file. Cast by create()

  • Error: class $package does not implement method $method.

Fatal error, bestie: the specific $package (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however 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()

  • Fault: failed to rename file $from to $to: $!

When a modified or new message is written to disk, it is first written to a temporary file in the folder directory. Then, the new file is moved to replace the existing file. Apparently, the latter fails. Cast by create()

  • Error: method bounce requires To, Cc, or Bcc.

The message bounce() method forwards a received message off to someone else without modification; you must specify its new destination. If you have the urge not to specify any destination, you probably are 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 need to 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()

  • Error: unable to read delayed body for message $msgid.

For some reason, the header of the message could be read, but the body cannot. Probably the file has disappeared or the permissions were changed during the progress of the program. Cast by loadBody()

  • Error: unable to read delayed head for message $msgid.

Mail::Box tries to be lazy with respect to parsing messages. When a directory organized folder is opened, only the filenames of messages are collected. At first use, the messages are read from their file. Apparently, a message is used for the first time here, but has disappeared or is unreadable for some other reason. Cast by loadBody()


🫢 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.


okay that's the whole page bestie, we ate and left no crumbs 🌈✨ this one's from perl v5.40.1, dated 2026-05-09, and yeah the header says Mail::...essage(3pm) which is the universe's little reminder that you already know which module you're in πŸ’– go read it, it's giving main character energy πŸ¦‹

πŸ“¦ where this page comes from