{
    "mode": "perldoc",
    "parameter": "Mail::Message::Body",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Mail%3A%3AMessage%3A%3ABody/json",
    "generated": "2026-06-09T14:01:32Z",
    "synopsis": "my Mail::Message $msg = ...;\nmy $body  = $msg->body;\nmy @text  = $body->lines;\nmy $text  = $body->string;\nmy $file  = $body->file;  # IO::File\n$body->print(\\*FILE);\nmy $contenttype = $body->type;\nmy $transferencoding = $body->transferEncoding;\nmy $encoded = $body->encode(mimetype => 'text/html',\ncharset => 'us-ascii', transferencoding => 'none');\\n\";\nmy $decoded = $body->decoded;",
    "sections": {
        "NAME": {
            "content": "Mail::Message::Body - the data of a body in a message\n",
            "subsections": []
        },
        "INHERITANCE": {
            "content": "Mail::Message::Body has extra code in\nMail::Message::Body::Construct\nMail::Message::Body::Encode\n\nMail::Message::Body\nis a Mail::Reporter\n\nMail::Message::Body is extended by\nMail::Message::Body::File\nMail::Message::Body::Lines\nMail::Message::Body::Multipart\nMail::Message::Body::Nested\nMail::Message::Body::String\n\nMail::Message::Body is realized by\nMail::Message::Body::Delayed\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my Mail::Message $msg = ...;\nmy $body  = $msg->body;\nmy @text  = $body->lines;\nmy $text  = $body->string;\nmy $file  = $body->file;  # IO::File\n$body->print(\\*FILE);\n\nmy $contenttype = $body->type;\nmy $transferencoding = $body->transferEncoding;\nmy $encoded = $body->encode(mimetype => 'text/html',\ncharset => 'us-ascii', transferencoding => 'none');\\n\";\nmy $decoded = $body->decoded;\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The encoding and decoding functionality of a Mail::Message::Body is implemented in the\nMail::Message::Body::Encode package. That package is automatically loaded when encoding and\ndecoding of messages needs to take place. Methods to simply build an process body objects are\nimplemented in Mail::Message::Body::Construct.\n\nThe body of a message (a Mail::Message object) is stored in one of the many body types. The\nfunctionality of each body type is equivalent, but there are performance differences. Each body\ntype has its own documentation with details about its implementation.\n\nExtends \"DESCRIPTION\" in Mail::Reporter.\n",
            "subsections": []
        },
        "OVERLOADED": {
            "content": "overload: \"\"\n(stringification) Returns the body as string --which will trigger completion-- unless called\nto produce a string for \"Carp\". The latter to avoid deep recursions.\n\nexample: stringification of body\n\nprint $msg->body;   # implicit by print\n\nmy $body = $msg->body;\nmy $x    = \"$body\"; # explicit by interpolation\n\noverload: '==' and '!='\n(numeric comparison) compares if two references point to the same message. This only\nproduces correct results is both arguments are message references within the same folder.\n\nexample: use of numeric comparison on a body\n\nmy $skip = $folder->message(3);\nforeach my $msg (@$folder)\n{   next if $msg == $skip;\n$msg->send;\n}\n\noverload: @{}\nWhen a body object is used as being an array reference, the lines of the body are returned.\nThis is the same as using lines().\n\nexample: using a body as array\n\nprint $body->lines->[1];  # second line\nprint $body->[1];         # same\n\nmy @lines = $body->lines;\nmy @lines = @$body;       # same\n\noverload: bool\nAlways returns a true value, which is needed to have overloaded objects to be used as in\n\"if($body)\". Otherwise, \"if(defined $body)\" would be needed to avoid a runtime error.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Extends \"METHODS\" in Mail::Reporter.\n",
            "subsections": [
                {
                    "name": "Constructors",
                    "content": "Extends \"Constructors\" in Mail::Reporter.\n\n$obj->clone()\nReturn a copy of this body, usually to be included in a cloned message. Use\nMail::Message::clone() for a whole message.\n\nMail::Message::Body->new(%options)\nBE WARNED that, what you specify here are encodings and such which are already in place. The\noptions will not trigger conversions. When you need conversions, first create a body with\noptions which tell what you've got, and then call encode() for what you need.\n\n-Option           --Defined in     --Default\nbasedon                            undef\ncharset                             'PERL' or <undef>\nchecked                             <false>\ncontentid                          undef\ndata                                undef\ndescription                         undef\ndisposition                         undef\neol                                 'NATIVE'\nfile                                undef\nfilename                            undef\nlog                Mail::Reporter   'WARNINGS'\nmessage                             undef\nmimetype                           'text/plain'\nmodified                            <false>\ntrace              Mail::Reporter   'WARNINGS'\ntransferencoding                   'none'\n\nbasedon => BODY\nThe information about encodings must be taken from the specified BODY, unless specified\ndifferently.\n\ncharset => CHARSET|'PERL'\nDefines the character-set which is used in the data. Only useful in combination with a\n\"mimetype\" which refers to \"text\" in any shape, which does not contain an explicit\ncharset already. This field is case-insensitive.\n\nWhen a known CHARSET is provided and the mime type says \"text\", then the data is expected\nto be bytes in that particular encoding (see Encode). When 'PERL' is given, then then the\ndata is in Perl's internal encoding (either latin1 or utf8, you shouldn't know!) More\ndetails in \"Character encoding PERL\"\n\nchecked => BOOLEAN\nWhether the added information has been check not to contain illegal octets with respect to\nthe transfer encoding and mime type. If not checked, and then set as body for a message,\nit will be.\n\ncontentid => STRING\nIn multipart/related MIME content, the contentid is required to allow access to the\nrelated content via a cid:<...> descriptor of an inline disposition.\n\nA \"Content-ID\" is supposed to be globally unique. As such, it is common to append\n'@computer.domain' to the end of some unique string. As other content in the\nmultipart/related container also needs to know what this \"Content-ID\" is, this should be\nleft to the imagination of the person making the content (for now).\n\nAs a MIME header field, the \"Content-ID\" string is expected to be inside angle brackets\n\ndata => ARRAY-OF-LINES | STRING\nThe content of the body. The only way to set the content of a body is during the creation\nof the body. So if you want to modify the content of a message, you need to create a new\nbody with the new content and add that to the body. The reason behind this, is that\ncorrect encodings and body information must be guaranteed. It avoids your hassle in\ncalculating the number of lines in the body, and checking whether bad characters are\nenclosed in text.\n\nSpecify a reference to an ARRAY of lines, each terminated by a newline. Or one STRING\nwhich may contain multiple lines, separated and terminated by a newline.\n\ndescription => STRING|FIELD\nInformal information about the body content. The data relates to the \"Content-Description\"\nfield. Specify a STRING which will become the field content, or a real FIELD.\n\ndisposition => STRING|FIELD\nHow this message can be decomposed. The data relates to the \"Content-Disposition\" field.\nSpecify a STRING which will become the field content, or a real FIELD.\n\nThe content of this field is specified in RFC 1806. The body of the field can be \"inline\",\nto indicate that the body is intended to be displayed automatically upon display of the\nmessage. Use \"attachment\" to indicate that they are separate from the main body of the\nmail message, and that their display should not be automatic, but contingent upon some\nfurther action of the user.\n\nThe \"filename\" attribute specifies a name to which is suggested to the reader of the\nmessage when it is extracted.\n\neol => 'CR'|'LF'|'CRLF'|'NATIVE'\nConvert the message into having the specified string as line terminator for all lines in\nthe body. \"NATIVE\" is used to represent the \"\\n\" on the current platform and will be\ntranslated in the applicable one.\n\nBE WARNED that folders with a non-native encoding may appear on your platform, for\ninstance in Windows folders handled from a UNIX system. The eol encoding has effect on the\nsize of the body!\n\nfile => FILENAME|FILEHANDLE|IOHANDLE\nRead the data from the specified file, file handle, or object of type \"IO::Handle\".\n\nfilename => FILENAME\n[3.001] Overrule/set filename for content-disposition\n\nlog => LEVEL\nmessage => MESSAGE\nThe message where this body belongs to.\n\nmimetype => STRING|FIELD|MIME\nThe type of data which is added. You may specify a content of a header line as STRING, or\na FIELD object. You may also specify a MIME::Type object. In any case, it will be kept\ninternally as a real field (a Mail::Message::Field object). This relates to the\n\"Content-Type\" header field.\n\nA mime-type specification consists of two parts: a general class (\"text\", \"image\",\n\"application\", etc) and a specific sub-class. Examples for specific classes with \"text\"\nare \"plain\", \"html\", and \"xml\". This field is case-insensitive but case preserving. The\ndefault mime-type is \"text/plain\",\n\nmodified => BOOLEAN\nWhether the body is flagged modified, directly from its creation.\n\ntrace => LEVEL\ntransferencoding => STRING|FIELD\nThe encoding that the data has. If the data is to be encoded, than you will have to call\nencode() after the body is created. That will return a new encoded body. This field is\ncase-insensitive and relates to the \"Content-Transfer-Encoding\" field in the header.\n\nexample:\n\nmy $body = Mail::Message::Body::String->new(file => \\*IN,\nmimetype => 'text/html; charset=\"ISO-8859-1\"');\n\nmy $body = Mail::Message::Body::Lines->new(data => ['first', $second],\ncharset => 'ISO-10646', transferencoding => 'none');\n\nmy $body = Mail::Message::Body::Lines->new(data => \\@lines,\ntransferencoding => 'base64');\n\nmy $body = Mail::Message::Body::Lines->new(file => 'picture.gif',\nmimetype => 'image/gif', contentid => '<12345@example.com>',\ndisposition => 'inline');\n"
                },
                {
                    "name": "Constructing a body",
                    "content": "$obj->attach($messages, %options)\nInherited, see \"Constructing a body\" in Mail::Message::Body::Construct\n\n$obj->check()\nInherited, see \"Constructing a body\" in Mail::Message::Body::Encode\n\n$obj->concatenate($components)\nInherited, see \"Constructing a body\" in Mail::Message::Body::Construct\n\n$obj->decoded(%options)\nReturns a body, an object which is (a sub-)class of a Mail::Message::Body, which contains a\nsimplified representation of textual data. The returned object may be the object where this\nis called on, but may also be a new body of any type.\n\nmy $dec = $body->decoded;\n\nis equivalent with\n\nmy $dec = $body->encode\n( mimetype         => 'text/plain'\n, transferencoding => 'none'\n, charset           => 'PERL'\n);\n\nThe $dec which is returned is a body. Ask with the mimeType() method what is produced. This\n$dec body is not related to a header.\n\n-Option     --Default\nresulttype  <same as current>\n\nresulttype => CLASS\n\n$obj->encode(%options)\nInherited, see \"Constructing a body\" in Mail::Message::Body::Encode\n\n$obj->encoded()\nInherited, see \"Constructing a body\" in Mail::Message::Body::Encode\n\n$obj->eol( ['CR'|'LF'|'CRLF'|'NATIVE'] )\nReturns the character (or characters) which are used to separate lines within this body.\nWhen a kind of separator is specified, the body is translated to contain the specified line\nendings.\n\nexample:\n\nmy $body = $msg->decoded->eol('NATIVE');\nmy $char = $msg->decoded->eol;\n\n$obj->foreachLine(CODE)\nInherited, see \"Constructing a body\" in Mail::Message::Body::Construct\n\n$obj->stripSignature(%options)\nInherited, see \"Constructing a body\" in Mail::Message::Body::Construct\n\n$obj->unify($body)\nInherited, see \"Constructing a body\" in Mail::Message::Body::Encode\n"
                },
                {
                    "name": "The body",
                    "content": "$obj->isDelayed()\nReturns a true or false value, depending on whether the body of this message has been read\nfrom file. This can only false for a Mail::Message::Body::Delayed.\n\n$obj->isMultipart()\nReturns whether this message-body contains parts which are messages by themselves.\n\n$obj->isNested()\nOnly true for a message body which contains exactly one sub-message: the\n\"Mail::Message::Body::Nested\" body type.\n\n$obj->message( [$message] )\nReturns the message (or message part) where this body belongs to, optionally setting it to a\nnew $message first. If \"undef\" is passed, the body will be disconnected from the message.\n\n$obj->partNumberOf($part)\nReturns a string for multiparts and nested, otherwise an error. It is used in\nMail::Message::partNumber().\n"
                },
                {
                    "name": "About the payload",
                    "content": "$obj->charset()\nReturns the character set which is used in the text body as string. This is part of the\nresult of what the \"type\" method returns.\n\n$obj->checked( [BOOLEAN] )\nReturns whether the body encoding has been checked or not (optionally after setting the flag\nto a new value).\n\n$obj->contentId( [STRING|$field] )\nReturns (optionally after setting) the id (unique reference) of a message part. The related\nheader field is \"Content-ID\". A Mail::Message::Field object is returned (which stringifies\ninto the field content). The field content will be \"none\" if no disposition was specified.\n\nThe argument can be a STRING (which is converted into a field), or a fully prepared header\n$field.\n\n$obj->description( [STRING|$field] )\nReturns (optionally after setting) the informal description of the body content. The related\nheader field is \"Content-Description\". A Mail::Message::Field object is returned (which\nstringifies into the field content). The field content will be \"none\" if no disposition was\nspecified.\n\nThe argument can be a STRING (which is converted into a field), or a fully prepared header\nfield.\n\n$obj->disposition( [STRING|$field] )\nReturns (optionally after setting) how the message can be disposed (unpacked). The related\nheader field is \"Content-Disposition\". A Mail::Message::Field object is returned (which\nstringifies into the field content). The field content will be \"none\" if no disposition was\nspecified.\n\nThe argument can be a STRING (which is converted into a field), or a fully prepared header\nfield.\n\n$obj->dispositionFilename( [$directory] )\nInherited, see \"About the payload\" in Mail::Message::Body::Encode\n\n$obj->isBinary()\nInherited, see \"About the payload\" in Mail::Message::Body::Encode\n\n$obj->isText()\nInherited, see \"About the payload\" in Mail::Message::Body::Encode\n\n$obj->mimeType()\nReturns a MIME::Type object which is related to this body's type. This differs from the\n\"type\" method, which results in a Mail::Message::Field.\n\nexample:\n\nif($body->mimeType eq 'text/html') {...}\nprint $body->mimeType->simplified;\n\n$obj->nrLines()\nReturns the number of lines in the message body. For multi-part messages, this includes the\nheader lines and boundaries of all the parts.\n\n$obj->size()\nThe total number of bytes in the message body. The size of the body is computed in the shape\nit is in. For example, if this is a base64 encoded message, the size of the encoded data is\nreturned; you may want to call Mail::Message::decoded() first.\n\n$obj->transferEncoding( [STRING|$field] )\nReturns the transfer-encoding of the data within this body as Mail::Message::Field (which\nstringifies to its content). If it needs to be changed, call the encode() or decoded()\nmethod. When no encoding is present, the field contains the text \"none\".\n\nThe optional STRING or $field enforces a new encoding to be set, without the actual required\ntranslations.\n\nexample:\n\nmy $transfer = $msg->decoded->transferEncoding;\n$transfer->print;   # --> Content-Encoding: base64\nprint $transfer;    # --> base64\n\nif($msg->body->transferEncoding eq 'none') {...}\n\n$obj->type( [STRING|$field] )\nReturns the type of information the body contains as Mail::Message::Field object. The type\nis taken from the header field \"Content-Type\". If the header did not contain that field,\nthen you will get a default field containing \"text/plain\".\n\nYou usually can better use mimeType(), because that will return a clever object with type\ninformation.\n\nexample:\n\nmy $msg     = $folder->message(6);\n$msg->get('Content-Type')->print;\n# --> Content-Type: text/plain; charset=\"us-ascii\"\n\nmy $content = $msg->decoded;\nmy $type    = $content->type;\n\nprint \"This is a $type message\\n\";\n# --> This is a text/plain; charset=\"us-ascii\" message\n\nprint \"This is a \", $type->body, \"message\\n\";\n# --> This is a text/plain message\n\nprint \"Comment: \", $type->comment, \"\\n\";\n# --> Comment: charset=\"us-ascii\"\n"
                },
                {
                    "name": "Access to the payload",
                    "content": "$obj->endsOnNewline()\nReturns whether the last line of the body is terminated by a new-line (in transport it will\nbecome a CRLF). An empty body will return true as well: the newline comes from the line\nbefore it.\n\n$obj->file()\nReturn the content of the body as a file handle. The returned stream may be a real file, or\na simulated file in any form that Perl supports. While you may not be able to write to the\nfile handle, you can read from it.\n\nWARNING: Even if the file handle supports writing, do not write to the file handle. If you\ndo, some of the internal values of the Mail::Message::Body may not be updated.\n\n$obj->lines()\nReturn the content of the body as a list of lines (in LIST context) or a reference to an\narray of lines (in SCALAR context). In scalar context the array of lines is cached to avoid\nneedless copying and therefore provide much faster access for large messages.\n\nTo just get the number of lines in the body, use the nrLines() method, which is usually much\nmore efficient.\n\nBE WARNED: For some types of bodies the reference will refer to the original data. You must\nnot change the referenced data! If you do, some of the essential internal variables of the\nMail::Message::Body may not be updated.\n\nexample:\n\nmy @lines    = $body->lines;     # copies lines\nmy $line3    = ($body->lines)[3] # only one copy\nprint $lines[0];\n\nmy $linesref = $body->lines;     # reference to originals\nmy $line3    = $body->lines->[3] # only one copy (faster)\nprint $linesref->[0];\n\nprint $body->[0];                # by overloading\n\n$obj->print( [$fh] )\nPrint the body to the specified $fh (defaults to the selected handle). The handle may be a\nGLOB, an IO::File object, or... any object with a \"print()\" method will do. Nothing useful\nis returned.\n\n$obj->printEscapedFrom($fh)\nPrint the body to the specified $fh but all lines which start with 'From ' (optionally\nalready preceded by >'s) will habe an > added in front. Nothing useful is returned.\n\n$obj->string()\nReturn the content of the body as a scalar (a single string). This is a copy of the\ninternally kept information.\n\nexample:\n\nmy $text = $body->string;\nprint \"Body: $body\\n\";     # by overloading\n\n$obj->stripTrailingNewline()\nRemove the newline from the last line, or the last line if it does not contain anything else\nthan a newline.\n\n$obj->write(%options)\nWrite the content of the body to a file. Be warned that you may want to decode the body\nbefore writing it!\n\n-Option  --Default\nfilename  <required>\n\nfilename => FILENAME\n\nexample: write the data to a file\n\nuse File::Temp;\nmy $fn = tempfile;\n$message->decoded->write(filename => $fn)\nor die \"Couldn't write to $fn: $!\\n\";\n\nexample: using the content-disposition information to write\n\nuse File::Temp;\nmy $dir = tempdir; mkdir $dir or die;\nmy $fn  = $message->body->dispositionFilename($dir);\n$message->decoded->write(filename => $fn)\nor die \"Couldn't write to $fn: $!\\n\";\n"
                },
                {
                    "name": "Internals",
                    "content": "$obj->addTransferEncHandler( $name, <$class|$object> )\nMail::Message::Body->addTransferEncHandler( $name, <$class|$object> )\nInherited, see \"Internals\" in Mail::Message::Body::Encode\n\n$obj->contentInfoFrom($head)\nTransfer the body related info from the header into this body.\n\n$obj->contentInfoTo($head)\nCopy the content information (the \"Content-*\" fields) into the specified $head. The body was\ncreated from raw data without the required information, which must be added. See also\ncontentInfoFrom().\n\n$obj->fileLocation( [$begin, $end] )\nThe location of the body in the file. Returned a list containing begin and end. The begin is\nthe offsets of the first byte if the folder used for this body. The end is the offset of the\nfirst byte of the next message.\n\n$obj->getTransferEncHandler($type)\nInherited, see \"Internals\" in Mail::Message::Body::Encode\n\n$obj->isModified()\nReturns whether the body has changed.\n\n$obj->load()\nBe sure that the body is loaded. This returns the loaded body.\n\n$obj->modified( [BOOLEAN] )\nChange the body modification flag. This will force a re-write of the body to a folder file\nwhen it is closed. It is quite dangerous to change the body: the same body may be shared\nbetween messages within your program.\n\nEspecially be warned that you have to change the message-id when you change the body of the\nmessage: no two messages should have the same id.\n\nWithout value, the current setting is returned, although you can better use isModified().\n\n$obj->moveLocation( [$distance] )\nMove the registration of the message to a new location over $distance. This is called when\nthe message is written to a new version of the same folder-file.\n\n$obj->read( $parser, $head, $bodytype, [$chars, [$lines]] )\nRead the body with the $parser from file. The implementation of this method will differ\nbetween types of bodies. The $bodytype argument is a class name or a code reference of a\nroutine which can produce a class name, and is used in multipart bodies to determine the\ntype of the body for each part.\n\nThe $chars argument is the estimated number of bytes in the body, or \"undef\" when this is\nnot known. This data can sometimes be derived from the header (the \"Content-Length\" line) or\nfile-size.\n\nThe second argument is the estimated number of $lines of the body. It is less useful than\nthe $chars but may be of help determining whether the message separator is trustworthy. This\nvalue may be found in the \"Lines\" field of the header.\n"
                },
                {
                    "name": "Error handling",
                    "content": "Extends \"Error handling\" in Mail::Reporter.\n\n$obj->AUTOLOAD()\nWhen an unknown method is called on a message body object, this may not be problematic. For\nperformance reasons, some methods are implemented in separate files, and only demand-loaded.\nIf this delayed compilation of additional modules does not help, an error will be produced.\n\n$obj->addReport($object)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )\nMail::Message::Body->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->errors()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->log( [$level, [$strings]] )\nMail::Message::Body->log( [$level, [$strings]] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logPriority($level)\nMail::Message::Body->logPriority($level)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logSettings()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->notImplemented()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->report( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->reportAll( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->trace( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->warnings()\nInherited, see \"Error handling\" in Mail::Reporter\n"
                },
                {
                    "name": "Cleanup",
                    "content": "Extends \"Cleanup\" in Mail::Reporter.\n\n$obj->DESTROY()\nInherited, see \"Cleanup\" in Mail::Reporter\n"
                }
            ]
        },
        "DETAILS": {
            "content": "",
            "subsections": [
                {
                    "name": "Access to the body",
                    "content": "A body can be contained in a message, but may also live without a message. In both cases it\nstores data, and the same questions can be asked: what type of data it is, how many bytes and\nlines, what encoding is used. Any body can be encoded and decoded, returning a new body object.\nHowever, bodies which are part of a message will always be in a shape that they can be written\nto a file or send to somewhere: they will be encoded if needed.\n\n. Example\n\nmy $body    = Mail::Message::Body::String->new(mimetype => 'image/gif');\n$body->print(\\*OUT);    # this is binary image data...\n\nmy $encoded = $message->body($body);\n$encoded->print(\\*OUT); # ascii data, encoded image\n\nNow encoded refers to the body of the $message which is the content of $body in a shape that it\ncan be transmitted. Usually \"base64\" encoding is used.\n"
                },
                {
                    "name": "Body class implementation",
                    "content": "The body of a message can be stored in many ways. Roughly, the implementations can be split in\ntwo groups: the data collectors and the complex bodies. The primer implement various ways to\naccess data, and are full compatible: they only differ in performance and memory footprint under\ndifferent circumstances. The latter are created to handle complex multiparts and lazy\nextraction.\n\nData collector bodies\n*   Mail::Message::Body::String\n\nThe whole message body is stored in one scalar. Small messages can be contained this way\nwithout performance penalties.\n\n*   Mail::Message::Body::Lines\n\nEach line of the message body is stored as single scalar. This is a useful representation\nfor a detailed look in the message body, which is usually line-organized.\n\n*   Mail::Message::Body::File\n\nThe message body is stored in an external temporary file. This type of storage is especially\nuseful when the body is large, the total folder is large, or memory is limited.\n\n*   Mail::Message::Body::InFolder\n\nNOT IMPLEMENTED YET. The message is kept in the folder, and is only taken out when the\ncontent is changed.\n\n*   Mail::Message::Body::External\n\nNOT IMPLEMENTED YET. The message is kept in a separate file, usually because the message\nbody is large. The difference with the \"::External\" object is that this external storage\nstays this way between closing and opening of a folder. The \"::External\" object only uses a\nfile when the folder is open.\n\nComplex bodies\n*   Mail::Message::Body::Delayed\n\nThe message-body is not yet read, but the exact location of the body is known so the message\ncan be read when needed. This is part of the lazy extraction mechanism. Once extracted, the\nobject can become any simple or complex body.\n\n*   Mail::Message::Body::Multipart\n\nThe message body contains a set of sub-messages (which can contain multipart bodies\nthemselves). Each sub-message is an instance of Mail::Message::Part, which is an extension\nof Mail::Message.\n\n*   Mail::Message::Body::Nested\n\nNested messages, like \"message/rfc822\": they contain a message in the body. For most code,\nthey simply behave like multiparts.\n"
                },
                {
                    "name": "Character encoding PERL",
                    "content": "A body object can be part of a message, or stand-alone. In case it is a part of a message, the\n\"transport encoding\" and the content must be in a shape that the data can be transported via\nSMTP.\n\nHowever, when you want to process the body data in simple Perl (or when you construct the body\ndata from normal Perl strings), you need to be aware of Perl's internal representation of\nstrings. That can either be latin1 or utf8 (not real UTF-8, but something alike, see the\nperlunicode manual page) So, before you start using the data from an incoming message, do\n\nmy $body  = $msg->decoded;\nmy @lines = $body->lines;\n\nNow, the body has character-set 'PERL' (when it is text)\n\nWhen you create a new body which contains text content (the default), it will be created with\ncharacter-set 'PERL' unless you specify a character-set explicitly.\n\nmy $body = Mail::Box::Body::Lines->new(data => \\@lines);\n# now mime=text/plain, charset=PERL\n\nmy $msg  = Mail::Message->buildFromBody($body);\n$msg->body($body);\n$msg->attach($body);   # etc\n# these all will convert the charset=PERL into real utf-8\n"
                }
            ]
        },
        "DIAGNOSTICS": {
            "content": "Warning: Charset $name is not known\nThe encoding or decoding of a message body encounters a character set which is not\nunderstood 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 understood, therefore no\ndecoding (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 is unknown. The decoded\ndata is returned.\n\nError: Package $package does not implement $method.\nFatal error: the specific package (or one of its superclasses) does not implement this\nmethod where it should. This message means that some other related classes do implement this\nmethod however the class at hand does not. Probably you should investigate this and probably\ninform the author of the package.\n\nWarning: Unknown line terminator $eol ignored\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "This module is part of Mail-Message distribution version 3.012, built on February 11, 2022.\nWebsite: http://perl.overmeer.net/CPAN/\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Copyrights 2001-2022 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://dev.perl.org/licenses/\n",
            "subsections": []
        }
    },
    "summary": "Mail::Message::Body - the data of a body in a message",
    "flags": [],
    "examples": [],
    "see_also": []
}