{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Message::Construct::Read (perldoc)\n\n## NAME\n\nMail::Message::Construct::Read - read a Mail::Message from a file handle\n\n## SYNOPSIS\n\nmy $msg1 = Mail::Message->read(\\*STDIN);\nmy $msg2 = Mail::Message->read(\\@lines);\n\n## DESCRIPTION\n\nWhen complex methods are called on a \"Mail::Message\" object, this package is autoloaded to\nsupport the reading of messages directly from any file handle.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (1 subsections)\n- **SEE ALSO**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Mail::Message::Construct::Read",
        "section": "",
        "mode": "perldoc",
        "summary": "Mail::Message::Construct::Read - read a Mail::Message from a file handle",
        "synopsis": "my $msg1 = Mail::Message->read(\\*STDIN);\nmy $msg2 = Mail::Message->read(\\@lines);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Constructing a message",
                        "lines": 52
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Mail::Message::Construct::Read - read a Mail::Message from a file handle\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "my $msg1 = Mail::Message->read(\\*STDIN);\nmy $msg2 = Mail::Message->read(\\@lines);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "When complex methods are called on a \"Mail::Message\" object, this package is autoloaded to\nsupport the reading of messages directly from any file handle.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Constructing a message",
                        "content": "Mail::Message->read($fh|STRING|SCALAR|ARRAY, %options)\nRead a message from a $fh, STRING, SCALAR, or a reference to an ARRAY of lines. Most\n%options are passed to the new() of the message which is created, but a few extra are\ndefined.\n\nPlease have a look at build() and buildFromBody() before thinking about this \"read\" method.\nUse this \"read\" only when you have a file-handle like STDIN to parse from, or some external\nsource of message lines. When you already have a separate set of head and body lines, then\n\"read\" is certainly not your best choice.\n\nSome people use this method in a procmail script: the message arrives at stdin, so we only\nhave a filehandle. In this case, you are stuck with this method. The message is preceded by\na line which can be used as message separator in mbox folders. See the example how to handle\nthat one.\n\nThis method will remove \"Status\" and \"X-Status\" fields when they appear in the source, to\navoid the risk that these fields accidentally interfere with your internal administration,\nwhich may have security implications.\n\n-Option             --Default\nbodytype            undef\nstripstatusfields  <true>\n\nbodytype => CLASS\nForce a body type (any specific implementation of a Mail::Message::Body) to be used to\nstore the message content. When the body is a multipart or nested, this will be overruled.\n\nstripstatusfields => BOOLEAN\nRemove the \"Status\" and \"X-Status\" fields from the message after reading, to lower the\nrisk that received messages from external sources interfere with your internal\nadministration. If you want fields not to be stripped (you would like to disable the\nstripping) you probably process folders yourself, which is a Bad Thing!\n\nexample:\n\nmy $msg1 = Mail::Message->read(\\*STDIN);\nmy $msg2 = Mail::Message->read(\\@lines, log => 'PROGRESS');\n$folder->addMessages($msg1, $msg2);\n\nmy $msg3 = Mail::Message->read(<<MSG);\nSubject: hello world\nTo: you@example.com\n# warning: empty line required !!!\nHi, greetings!\nMSG\n\n# promail example\nmy $fromline = <STDIN>;\nmy $msg      = Mail::Message->read(\\*STDIN);\nmy $coerced  = $mboxfolder->addMessage($msg);\n$coerced->fromLine($fromline);\n"
                    }
                ]
            },
            "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": []
            }
        }
    }
}