Mail::M...sferEnc(3)

✨ NAME ✨

Mail::Message::TransferEnc β€” the message transfer encoder/decoder, bestie πŸ’…

It's the base class situation for all the little encoders and decoders that do their thing while your message is in transit. You're gonna meet it in Mail::M...sferEnc(3) and honestly? It's giving infrastructure queen. πŸ‘‘


🌈 INHERITANCE 🌈

  • Mail::Message::TransferEnc is a Mail::Reporter (yes it's a nepo baby, we love that for it)
  • Mail::Message::TransferEnc is extended by:
    • Mail::Message::TransferEnc::Base64
    • Mail::Message::TransferEnc::Binary
    • Mail::Message::TransferEnc::EightBit
    • Mail::Message::TransferEnc::QuotedPrint
    • Mail::Message::TransferEnc::SevenBit

πŸŽ€ SYNOPSIS πŸŽ€

my Mail::Message $msg = ...;
my $decoded = $msg->decoded;
my $encoded = $msg->encode(transfer => 'base64');

πŸ’– DESCRIPTION πŸ’–

Okay so. This class is the base for a whole squad of encoders and decoders that get used while your message is being transported around. All of these packages β€” and every single one derived from them β€” get invoked by the message's Mail::Message::decoded() and Mail::Message::encode() methods:

my $message = $folder->message(3);
my $decoded_body = $message->decoded;
my $encoded_body = $message->encode(transfer => 'base64');

The rules for transfer encodings live in RFC4289. And the full list of permissible content transfer encodings? It's at https://www.iana.org/assignments/transfer-encodings/transfer-encodings.xhtml β€” go off, IANA. 🫢

Here's the current roster of coders/decoders (as of April 2025, full list over at IANA):

  • Mail::Message::TransferEnc::Base64
    • base64, for binary information. the moment πŸ’…
  • Mail::Message::TransferEnc::SevenBit
    • 7bit, for plain old ASCII characters only. vintage, lowkey iconic.
  • Mail::Message::TransferEnc::EightBit
    • 8bit, for extended character set data β€” not encoded, just vibing as-is.
  • Mail::Message::TransferEnc::QuotedPrint
    • quoted-printable encoded extended character set data. yes babe, we encode that.

Extends "DESCRIPTION" in Mail::Reporter.


πŸ”₯ METHODS πŸ”₯

Extends "METHODS" in Mail::Reporter.


🧚 Constructors 🧚

Extends "Constructors" in Mail::Reporter.

  • $class->new(%options) β€” Inherited, see "Constructors" in Mail::Reporter.

🌸 Attributes 🌸

Extends "Attributes" in Mail::Reporter.


πŸ‘‘ The Encoder πŸ‘‘

  • $class->addTransferEncoder($type, $class) β€” Adds one shiny new encoder to the list that the Mail::Box suite knows about. The $type is the thing you'll find in the message's header, in the Content-Transfer-Encoding field.
  • $obj->create($type, %options) β€” Spins up a fresh coder/decoder based on the type you require.
  • $obj->name() β€” The name of the encoder. Case is not significant, so don't stress about the caps, she doesn't care. πŸ™ˆ

πŸ¦‹ Encoding πŸ¦‹

  • $obj->check($body, %options) β€” Checks whether the body is correctly encoded. If it is, you get the body reference back, with the checked flag set. If it's not, a brand new object gets created and returned instead. glow-up moment ✨
 -Option     --Default
  result_type  <type of source body>
  • result_type => CLASS β€” The type of the body to be produced, when the checker decides to return modified data.
  • $obj->decode($body, %options) β€” Uses the encoder to decode the content of $body. A new body is returned, periodt.
 -Option     --Default
  result_type  <type of source body>
  • result_type => CLASS β€” The type of the body to be produced, when the decoder decides to return modified data.
  • $obj->encode($body, %options) β€” Uses the encoder to encode the content of $body.
 -Option     --Default
  result_type  <type of source body>
  • result_type => CLASS β€” The type of the body to be produced, when the decoder decides to return modified data.

πŸ’€ Error handling πŸ’€

Extends "Error handling" in Mail::Reporter.

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

πŸŽ€ Cleanup πŸŽ€

Extends "Cleanup" in Mail::Reporter.

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

⭐ DIAGNOSTICS ⭐

  • 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 is that some other related classes do implement this method, but the class in your hands simply does not. Probably you should investigate this, and probably you should inform the author of the package. Cast by notImplemented().
  • Error: decoder for transfer encoding $type does not work: $@ Compiling the required transfer encoding threw errors, which means the decoder cannot be used. Cast by create().
  • Error: no decoder for transfer encoding $type. A decoder for that specified type of transfer encoding just isn't implemented. Cast by create().

🌈 SEE ALSO 🌈

This module is part of Mail-Message version 4.04, built on February 04, 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.


and that's a wrap, angel πŸ’– this page was brought to you by perl v5.42.0, dated 2026-02-05, serving you Mail::M...sferEnc(3) realness. go forth and transfer-encode responsibly πŸŽ€βœ¨

πŸ“¦ where this page comes from