{
    "content": [
        {
            "type": "text",
            "text": "# Email::Simple (perldoc)\n\n## NAME\n\nEmail::Simple - simple parsing of RFC2822 message format and headers\n\n## SYNOPSIS\n\nuse Email::Simple;\nmy $email = Email::Simple->new($text);\nmy $fromheader = $email->header(\"From\");\nmy @received = $email->header(\"Received\");\n$email->headerset(\"From\", 'Simon Cozens <simon@cpan.org>');\nmy $oldbody = $email->body;\n$email->bodyset(\"Hello world\\nSimon\");\nprint $email->asstring;\n...or, to create a message from scratch...\nmy $email = Email::Simple->create(\nheader => [\nFrom    => 'casey@geeknest.com',\nTo      => 'drain@example.com',\nSubject => 'Message in a bottle',\n],\nbody => '...',\n);\n$email->headerset( 'X-Content-Container' => 'bottle/glass' );\nprint $email->asstring;\n\n## DESCRIPTION\n\nThe Email:: namespace was begun as a reaction against the increasing complexity and bugginess of\nPerl's existing email modules. \"Email::*\" modules are meant to be simple to use and to maintain,\npared to the bone, fast, minimal in their external dependencies, and correct.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS**\n- **CAVEATS**\n- **AUTHORS**\n- **CONTRIBUTORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Email::Simple",
        "section": "",
        "mode": "perldoc",
        "summary": "Email::Simple - simple parsing of RFC2822 message format and headers",
        "synopsis": "use Email::Simple;\nmy $email = Email::Simple->new($text);\nmy $fromheader = $email->header(\"From\");\nmy @received = $email->header(\"Received\");\n$email->headerset(\"From\", 'Simon Cozens <simon@cpan.org>');\nmy $oldbody = $email->body;\n$email->bodyset(\"Hello world\\nSimon\");\nprint $email->asstring;\n...or, to create a message from scratch...\nmy $email = Email::Simple->create(\nheader => [\nFrom    => 'casey@geeknest.com',\nTo      => 'drain@example.com',\nSubject => 'Message in a bottle',\n],\nbody => '...',\n);\n$email->headerset( 'X-Content-Container' => 'bottle/glass' );\nprint $email->asstring;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 100,
                "subsections": []
            },
            {
                "name": "CAVEATS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "CONTRIBUTORS",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Email::Simple - simple parsing of RFC2822 message format and headers\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 2.216\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Email::Simple;\nmy $email = Email::Simple->new($text);\n\nmy $fromheader = $email->header(\"From\");\nmy @received = $email->header(\"Received\");\n\n$email->headerset(\"From\", 'Simon Cozens <simon@cpan.org>');\n\nmy $oldbody = $email->body;\n$email->bodyset(\"Hello world\\nSimon\");\n\nprint $email->asstring;\n\n...or, to create a message from scratch...\n\nmy $email = Email::Simple->create(\nheader => [\nFrom    => 'casey@geeknest.com',\nTo      => 'drain@example.com',\nSubject => 'Message in a bottle',\n],\nbody => '...',\n);\n\n$email->headerset( 'X-Content-Container' => 'bottle/glass' );\n\nprint $email->asstring;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The Email:: namespace was begun as a reaction against the increasing complexity and bugginess of\nPerl's existing email modules. \"Email::*\" modules are meant to be simple to use and to maintain,\npared to the bone, fast, minimal in their external dependencies, and correct.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "new\nmy $email = Email::Simple->new($message, \\%arg);\n\nThis method parses an email from a scalar containing an RFC2822 formatted message and returns an\nobject. $message may be a reference to a message string, in which case the string will be\naltered in place. This can result in significant memory savings.\n\nIf you want to create a message from scratch, you should use the \"create\" method.\n\nValid arguments are:\n\nheaderclass - the class used to create new header objects\nThe named module is not 'require'-ed by Email::Simple!\n\ncreate\nmy $email = Email::Simple->create(header => [ @headers ], body => '...');\n\nThis method is a constructor that creates an Email::Simple object from a set of named\nparameters. The \"header\" parameter's value is a list reference containing a set of headers to be\ncreated. The \"body\" parameter's value is a scalar value holding the contents of the message\nbody. Line endings in the body will normalized to CRLF.\n\nIf no \"Date\" header is specified, one will be provided for you based on the \"gmtime\" of the\nlocal machine. This is because the \"Date\" field is a required header and is a pain in the neck\nto create manually for every message. The \"From\" field is also a required header, but it is\n*not* provided for you.\n\nheaderobj\nmy $header = $email->headerobj;\n\nThis method returns the object representing the email's header. For the interface for this\nobject, see Email::Simple::Header.\n\nheaderobjset\n$email->headerobjset($newheaderobj);\n\nThis method substitutes the given new header object for the email's existing header object.\n\nheader\nmy @values = $email->header($headername);\nmy $first  = $email->header($headername);\nmy $value  = $email->header($headername, $index);\n\nIn list context, this returns every value for the named header. In scalar context, it returns\nthe *first* value for the named header. If second parameter is specified then instead *first*\nvalue it returns value at position $index (negative $index is from the end).\n\nheaderset\n$email->headerset($field, $line1, $line2, ...);\n\nSets the header to contain the given data. If you pass multiple lines in, you get multiple\nheaders, and order is retained. If no values are given to set, the header will be removed from\nto the message entirely.\n\nheaderraw\nThis is another name (and the preferred one) for \"header\".\n\nheaderrawset\nThis is another name (and the preferred one) for \"headerset\".\n\nheaderrawprepend\n$email->headerrawprepend($field => $value);\n\nThis method adds a new instance of the name field as the first field in the header.\n\nheadernames\nmy @headernames = $email->headernames;\n\nThis method returns the list of header names currently in the email object. These names can be\npassed to the \"header\" method one-at-a-time to get header values. You are guaranteed to get a\nset of headers that are unique. You are not guaranteed to get the headers in any order at all.\n\nFor backwards compatibility, this method can also be called as headers.\n\nheaderpairs\nmy @headers = $email->headerpairs;\n\nThis method returns a list of pairs describing the contents of the header. Every other value,\nstarting with and including zeroth, is a header name and the value following it is the header\nvalue.\n\nheaderrawpairs\nThis is another name (and the preferred one) for \"headerpairs\".\n\nbody\nReturns the body text of the mail.\n\nbodyset\nSets the body text of the mail.\n\nasstring\nReturns the mail as a string, reconstructing the headers.\n\ncrlf\nThis method returns the type of newline used in the email. It is an accessor only.\n\ndefaultheaderclass\nThis returns the class used, by default, for header objects, and is provided for subclassing.\nThe default default is Email::Simple::Header.\n",
                "subsections": []
            },
            "CAVEATS": {
                "content": "Email::Simple handles only RFC2822 formatted messages. This means you cannot expect it to cope\nwell as the only parser between you and the outside world, say for example when writing a mail\nfilter for invocation from a .forward file (for this we recommend you use Email::Filter anyway).\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "*   Simon Cozens\n\n*   Casey West\n\n*   Ricardo SIGNES\n",
                "subsections": []
            },
            "CONTRIBUTORS": {
                "content": "*   Brian Cassidy <bricas@cpan.org>\n\n*   Christian Walde <walde.christian@googlemail.com>\n\n*   Marc Bradshaw <marc@marcbradshaw.net>\n\n*   Michael Stevens <mstevens@etla.org>\n\n*   Pali <pali@cpan.org>\n\n*   Ricardo SIGNES <rjbs@cpan.org>\n\n*   Ronald F. Guilmette <rfg@tristatelogic.com>\n\n*   William Yardley <pep@veggiechinese.net>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "This software is copyright (c) 2003 by Simon Cozens.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
                "subsections": []
            }
        }
    }
}