{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Message::Body::Encode (info)\n\n## NAME\n\nMail::Message::Body::Encode - organize general message encodings\n\n## SYNOPSIS\n\nmy Mail::Message $msg = ...;\nmy $decoded = $msg->decoded;\nmy $encoded = $msg->encode(mimetype => 'image/gif',\ntransferencoding => 'base64');\nmy $body = $msg->body;\nmy $decoded = $body->decoded;\nmy $encoded = $body->encode(transferencoding => '7bit');\n\n## DESCRIPTION\n\nManages the message's body encodings and decodings on request of the\nmain program.  This package adds functionality to the\nMail::Message::Body class when the decoded() or encode() method is\ncalled.\n\n## Sections\n\n- **Mail::Message::Body::EUsereContributed Perl DoMail::Message::Body::Encode(3pm)**\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS**\n- **DIAGNOSTICS**\n- **SEE ALSO**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Mail::Message::Body::Encode",
        "section": "",
        "mode": "info",
        "summary": "Mail::Message::Body::Encode - organize general message encodings",
        "synopsis": "my Mail::Message $msg = ...;\nmy $decoded = $msg->decoded;\nmy $encoded = $msg->encode(mimetype => 'image/gif',\ntransferencoding => 'base64');\nmy $body = $msg->body;\nmy $decoded = $body->decoded;\nmy $encoded = $body->encode(transferencoding => '7bit');",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "Mail::Message::Body::EUsereContributed Perl DoMail::Message::Body::Encode(3pm)",
                "lines": 1,
                "subsections": []
            },
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 30,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 100,
                "subsections": []
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "Mail::Message::Body::EUsereContributed Perl DoMail::Message::Body::Encode(3pm)": {
                "content": "",
                "subsections": []
            },
            "NAME": {
                "content": "Mail::Message::Body::Encode - organize general message encodings\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "my Mail::Message $msg = ...;\nmy $decoded = $msg->decoded;\nmy $encoded = $msg->encode(mimetype => 'image/gif',\ntransferencoding => 'base64');\n\nmy $body = $msg->body;\nmy $decoded = $body->decoded;\nmy $encoded = $body->encode(transferencoding => '7bit');\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Manages the message's body encodings and decodings on request of the\nmain program.  This package adds functionality to the\nMail::Message::Body class when the decoded() or encode() method is\ncalled.\n\nFour types of encodings are handled (in the right order)\n\no   eol encoding\n\nVarious operating systems have different ideas about how to encode\nthe line termination.  UNIX uses a LF character, MacOS uses a CR,\nand Windows uses a CR/LF combination.  Messages which are\ntransported over Internet will always use the CRLF separator.\n\no   transfer encoding\n\nMessages transmitted over Internet have to be plain ASCII.\nComplicated characters and binary files (like images and archives)\nmust be encoded during transmission to an ASCII representation.\n\nThe implementation of the required encoders and decoders is found\nin the Mail::Message::TransferEnc set of packages.  The related\nmanual page lists the transfer encodings which are supported.\n\no   mime-type translation\n\nNOT IMPLEMENTED YET\n\no   charset conversion\n",
                "subsections": []
            },
            "METHODS": {
                "content": "Constructing a body\n$obj->check()\nCheck the content of the body not to include illegal characters.\nWhich characters are considered illegal depends on the encoding of\nthis body.\n\nA body is returned which is checked.  This may be the body where\nthis method is called upon, but also a new object, when serious\nchanges had to be made.  If the check could not be made, because\nthe decoder is not defined, then \"undef\" is returned.\n\n$obj->encode(%options)\nEncode (translate) a Mail::Message::Body into a different format.\nSee the DESCRIPTION above.  Options which are not specified will\nnot trigger conversions.\n\n-Option           --Default\ncharset            PERL if text\nmimetype          undef\nresulttype        <same as source>\ntransferencoding  undef\n\ncharset => CODESET|'PERL'\nIf the CODESET is explicitly specified (for instance\n\"iso-8859-10\", then the data is interpreted as raw bytes (blob),\nnot as text.  However, in case of \"PERL\", it is considered to be\nan internal representation of characters (either latin1 or Perl's\nutf8 --not the same as utf-8--, you should not know).\n\nmimetype => STRING|FIELD\nConvert into the specified mime type, which can be specified as\nSTRING or FIELD.  The FIELD is a Mail::Message::Field, and the\nSTRING is converted in such object before use.\n\nresulttype => CLASS\nThe type of body to be created when the body is changed to\nfulfill the request on re-coding.  Also the intermediate stages\nin the translation process (if needed) will use this type. CLASS\nmust extend Mail::Message::Body.\n\ntransferencoding => STRING|FIELD\n$obj->encoded()\nEncode the body to a format what is acceptable to transmit or write\nto a folder file.  This returns the body where this method was\ncalled upon when everything was already prepared, or a new encoded\nbody otherwise.  In either case, the body is checked.\n\n$obj->unify($body)\nUnify the type of the given $body objects with the type of the\ncalled body.  \"undef\" is returned when unification is impossible.\nIf the bodies have the same settings, the $body object is returned\nunchanged.\n\nExamples:\n\nmy $bodytype = Mail::Message::Body::Lines;\nmy $html  = $bodytype->new(mimetype=>'text/html', data => []);\nmy $plain = $bodytype->new(mimetype=>'text/plain', ...);\n\nmy $unified = $html->unify($plain);\n# $unified is the data of plain translated to html (if possible).\n\nAbout the payload\n$obj->dispositionFilename( [$directory] )\nVarious fields are searched for \"filename\" and \"name\" attributes.\nWithout $directory, the name found will be returned unmodified.\n\nWhen a $directory is given, a filename is composed.  For security\nreasons, only the basename of the found name gets used and many\npotentially dangerous characters removed.  If no name was found, or\nwhen the found name is already in use, then an unique name is\ngenerated.\n\nDon't forget to read RFC6266 section 4.3 for the security aspects\nin your email application.\n\n$obj->isBinary()\nReturns true when the un-encoded message is binary data.  This\ninformation is retrieved from knowledge provided by MIME::Types.\n\n$obj->isText()\nReturns true when the un-encoded message contains printable text.\n\nInternals\n$obj->addTransferEncHandler( $name, <$class|$object> )\nMail::Message::Body->addTransferEncHandler( $name, <$class|$object> )\nRelate the NAMEd transfer encoding to an OBJECTs or object of the\nspecified $class.  In the latter case, an object of that $class\nwill be created on the moment that one is needed to do encoding or\ndecoding.\n\nThe $class or $object must extend Mail::Message::TransferEnc.  It\nwill replace existing class and object for this $name.\n\nWhy aren't you contributing this class to MailBox?\n\n$obj->getTransferEncHandler($type)\nGet the transfer encoder/decoder which is able to handle $type, or\nreturn undef if there is no such handler.\n",
                "subsections": []
            },
            "DIAGNOSTICS": {
                "content": "Warning: Charset $name is not known\nThe encoding or decoding of a message body encounters a character\nset which is not understood by Perl's Encode module.\n\nWarning: No decoder defined for transfer encoding $name.\nThe data (message body) is encoded in a way which is not currently\nunderstood, therefore no decoding (or recoding) can take place.\n\nWarning: No encoder defined for transfer encoding $name.\nThe data (message body) has been decoded, but the required encoding\nis unknown.  The decoded data is returned.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "This module is part of Mail-Message distribution version 3.012, built\non February 11, 2022. Website: http://perl.overmeer.net/CPAN/\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "Copyrights 2001-2022 by [Mark Overmeer <markov@cpan.org>]. For other\ncontributors see ChangeLog.\n\nThis program is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.  See http://dev.perl.org/licenses/\n\nperl v5.34.0                      2022-02-14  Mail::Message::Body::Encode(3pm)",
                "subsections": []
            }
        }
    }
}