Mail::M...eEntity(3)

πŸ’– Mail::Message::Convert::MimeEntity β€” bestie edition ✨

okay so the manual name is Mail::M...eEntity(3) (yes she's got an ellipsis in her name, iconic of her honestly) and she's here to translate Mail::Message to MIME::Entity vv. that's the whole vibe. converting between two message worlds. no cap.


🌸 INHERITANCE

the family tree, and she did NOT come from nowhere:

 Mail::Message::Convert::MimeEntity
   is a Mail::Message::Convert
   is a Mail::Reporter

so she inherits from Mail::Message::Convert, which inherits from Mail::Reporter. generational wealth tbh πŸ’…


✨ SYNOPSIS

here's the whole serve, copy it exactly bestie:

use Mail::Message::Convert::MimeEntity;
my $convert = Mail::Message::Convert::MimeEntity->new;

my Mail::Message $msg    = Mail::Message->new;
my MIME::Entity  $entity = $convert->export($msg);

my MIME::Entity  $entity = MIME::Entity->new;
my Mail::Message $msg    = $convert->from($entity);

use Mail::Box::Manager;
my $mgr     = Mail::Box::Manager->new;
my $folder  = $mgr->open(folder => 'Outbox');
$folder->addMessage($entity);

like. she takes your Mail::Message, hands you back a MIME::Entity, and does the reverse too. then you can yeet that entity straight into a folder with Mail::Box::Manager. main character energy fr fr 🫢


πŸ¦‹ DESCRIPTION

so MIME::Entity is that girl who takes a Mail::Internet message and levels it up with multiparts and extra methods. slay.

meanwhile Mail::Message objects are way more flexible about how the message parts get stored β€” they keep separate header and body objects instead of mashing it all together. different philosophies, both valid, we don't pit them against each other πŸ’–

also this section extends "DESCRIPTION" in Mail::Message::Convert, so peek at that one too if you wanna go deeper.


πŸŽ€ METHODS

extends "METHODS" in Mail::Message::Convert. yes she's built different.

πŸ”₯ Constructors

extends "Constructors" in Mail::Message::Convert.

  • $class->new(%options) β€” inherited, so go read "METHODS" in Mail::Message::Convert for the deets.

πŸ’… Attributes

extends "Attributes" in Mail::Message::Convert.

🌈 Converting

extends "Converting" in Mail::Message::Convert.

  • $obj->export( $message, [$parser] ) β€” she hands you back a brand new MIME::Entity message object built from the info in $message, which has to be a Mail::Message object.

now listen β€” you can pass in your own $parser if you want, which is a MIME::Parser object, and that's how you change the parser flags. no $parser? no problem, she makes one for you with all the default settings. queen of backup plans πŸ‘‘

if you pass undef where a $message should be, you get back an empty list. and if the parsing failes β€” yes that's the original spelling, we're keeping it, character for character β€” then MIME::Parser throws an exception. so like. be ready for that.

Β» example:

my $convert = Mail::Message::Convert::MimeEntity->new;
my Mail::Message $msg  = Mail::Message->new;
my MIME::Entity  $copy = $convert->export($msg);
  • $obj->from($mime_object) β€” the reverse serve. gives you a new Mail::Message object built from the info in the MIME::Entity you specified. if the conversion fails, undef comes back. and if you pass undef in place of an OBJECT, you get an empty list. (she's consistent about the undef thing, we love a girl with rules πŸ’€)

Β» example:

my $convert = Mail::Message::Convert::MimeEntity->new;
my MIME::Entity  $msg  = MIME::Entity->new;
my Mail::Message $copy = $convert->from($msg);
  • $obj->selectedFields($head) β€” inherited, go see "Converting" in Mail::Message::Convert.

πŸ™ˆ Error handling

extends "Error handling" in Mail::Message::Convert.

  • $obj->AUTOLOAD() β€” inherited, see "Error handling" in Mail::Reporter.
  • $obj->notImplemented() β€” inherited, see "Error handling" in Mail::Reporter.

🧚 Cleanup

extends "Cleanup" in Mail::Message::Convert.

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

πŸ’€ DIAGNOSTICS

the error messages, in all their dramatic glory:

  • 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. what this means: some other related classes do implement it, but the class you're holding does not. so probably go investigate, and probably inform the author of the package. cast by notImplemented().
  • Error: converting from MIME::Entity but got a $class. cast by from().
  • Error: export message must be a Mail::Message object, but is $what. cast by export().

πŸ”₯ SEE ALSO

this module is part of Mail-Message version 4.04, built on February 04, 2026. website: http://perl.overmeer.net/CPAN/ β€” go say hi πŸ’–


πŸ‘‘ 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. periodt.


and that's the whole page, bestie ✨ this doc was rendered by perl v5.42.0 on 2026-02-05, under the manual name Mail::M...eEntity(3) β€” go forth and convert those messages, i'm obsessed with you πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from