{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Internet (perldoc)\n\n## NAME\n\nMail::Internet - manipulate email messages\n\n## SYNOPSIS\n\nuse Mail::Internet;\nmy $msg = Mail::Internet->new(\\*STDIN);\n\n## DESCRIPTION\n\nThis package implements reading, creating, manipulating, and writing email messages. Sometimes,\nthe implementation tries to be too smart, but in the general case it works as expected.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (6 subsections)\n- **SEE ALSO**\n- **AUTHORS**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Mail::Internet",
        "section": "",
        "mode": "perldoc",
        "summary": "Mail::Internet - manipulate email messages",
        "synopsis": "use Mail::Internet;\nmy $msg = Mail::Internet->new(\\*STDIN);",
        "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": 8,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Constructors",
                        "lines": 34
                    },
                    {
                        "name": "Accessors",
                        "lines": 11
                    },
                    {
                        "name": "Processing the message as a whole",
                        "lines": 21
                    },
                    {
                        "name": "Processing the header",
                        "lines": 31
                    },
                    {
                        "name": "Processing the body",
                        "lines": 21
                    },
                    {
                        "name": "High-level functionality",
                        "lines": 102
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Mail::Internet - manipulate email messages\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Mail::Internet;\nmy $msg = Mail::Internet->new(\\*STDIN);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This package implements reading, creating, manipulating, and writing email messages. Sometimes,\nthe implementation tries to be too smart, but in the general case it works as expected.\n\nIf you start writing a new application, you should use the Mail::Box distribution, which has\nmore features and handles messages much better according to the RFCs. See\n<http://perl.overmeer.net/mailbox/>. You may also chose MIME::Entity, to get at least some\nmultipart support in your application.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Constructors",
                        "content": "$obj->dup()\nDuplicate the message as a whole. Both header and body will be deep-copied: a new\nMail::Internet object is returned.\n\n$obj->extract(\\@lines)\nExtract header and body from an ARRAY of message lines. Requires an object already created\nwith new(), which contents will get overwritten.\n\n$obj->new( [$arg], [%options] )\nMail::Internet->new( [$arg], [%options] )\n$arg is optional and may be either a file descriptor (reference to a GLOB) or a reference to\nan array. If given the new object will be initialized with headers and body either from the\narray of read from the file descriptor.\n\nThe Mail::Header::new() %options \"Modify\", \"MailFrom\" and \"FoldLength\" may also be given.\n\n-Option--Default\nBody    []\nHeader  undef\n\nBody => ARRAY-of-LINES\nThe value of this option should be a reference to an array which contains the lines for\nthe body of the message. Each line should be terminated with \"\\n\" (LF). If Body is given\nthen \"Mail::Internet\" will not attempt to read the body from $arg (even if it is\nspecified).\n\nHeader => Mail::Header\nThe value of this option should be a Mail::Header object. If given then \"Mail::Internet\"\nwill not attempt to read a mail header from $arg, if it was specified.\n\n$obj->read($fh)\nRead a message from the $fh into an already existing message object. Better use new() with\nthe $fh as first argument.\n"
                    },
                    {
                        "name": "Accessors",
                        "content": "$obj->body( [$body] )\nReturns the body of the message. This is a reference to an array. Each entry in the array\nrepresents a single line in the message.\n\nIf *$body* is given, it can be a reference to an array or an array, then the body will be\nreplaced. If a reference is passed, it is used directly and not copied, so any subsequent\nchanges to the array will change the contents of the body.\n\n$obj->head()\nReturns the \"Mail::Header\" object which holds the headers for the current message\n"
                    },
                    {
                        "name": "Processing the message as a whole",
                        "content": "$obj->asmboxstring( [$alreadyescaped] )\nReturns the message as a string in mbox format. $alreadyescaped, if given and true,\nindicates that escapefrom() has already been called on this object.\n\n$obj->asstring()\nReturns the message as a single string.\n\n$obj->print( [$fh] )\nPrint the header, body or whole message to file descriptor *$fh*. *$fd* should be a\nreference to a GLOB. If *$fh* is not given the output will be sent to STDOUT.\n\nexample:\n\n$mail->print( \\*STDOUT );  # Print message to STDOUT\n\n$obj->printbody( [$fh] )\nPrint only the body to the $fh (default STDOUT).\n\n$obj->printheader( [$fh] )\nPrint only the header to the $fh (default STDOUT).\n"
                    },
                    {
                        "name": "Processing the header",
                        "content": "Most of these methods are simply wrappers around methods provided by Mail::Header.\n\n$obj->add(PAIRS)\nThe PAIRS are field-name and field-content. For each PAIR, Mail::Header::add() is called.\nAll fields are added after existing fields. The last addition is returned.\n\n$obj->combine( $tag, [$with] )\nSee Mail::Header::combine().\n\n$obj->delete( $tag, [$tags] )\nDelete all fields with the name $tag. Mail::Header::delete() is doing the work.\n\n$obj->fold( [$length] )\nSee Mail::Header::fold().\n\n$obj->foldlength( [$tag], [$length] )\nSee Mail::Header::foldlength().\n\n$obj->get( $tag, [$tags] )\nIn LIST context, all fields with the name $tag are returned. In SCALAR context, only the\nfirst field which matches the earliest $tag is returned. Mail::Header::get() is called to\ncollect the data.\n\n$obj->header(\\@lines)\nSee Mail::Header::header().\n\n$obj->replace(PAIRS)\nThe PAIRS are field-name and field-content. For each PAIR, Mail::Header::replace() is called\nwith index 0. If a $field is already in the header, it will be removed first. Do not\nspecified the same field-name twice.\n"
                    },
                    {
                        "name": "Processing the body",
                        "content": "$obj->removesig( [$nlines] )\nAttempts to remove a user's signature from the body of a message. It does this by looking\nfor a line equal to '-- ' within the last $nlines of the message. If found then that line\nand all lines after it will be removed. If $nlines is not given a default value of 10 will\nbe used. This would be of most use in auto-reply scripts.\n\n$obj->sign(%options)\nAdd your signature to the body. removesig() will strip existing signatures first.\n\n-Option   --Default\nFile       undef\nSignature  []\n\nFile => FILEHANDLE\nTake from the FILEHANDLE all lines starting from the first \"--\".\n\nSignature => STRING|ARRAY-of-LINES\n\n$obj->tidybody()\nRemoves all leading and trailing lines from the body that only contain white spaces.\n"
                    },
                    {
                        "name": "High-level functionality",
                        "content": "$obj->escapefrom()\nIt can cause problems with some applications if a message contains a line starting with\n`From ', in particular when attempting to split a folder. This method inserts a leading\n\"`\"'> on any line that matches the regular expression \"/^\"*From/>\n\n$obj->nntppost( [%options] )\nPost an article via NNTP. Requires Net::NNTP to be installed.\n\n-Option--Default\nDebug   <false>\nHost    <required>\nPort    119\n\nDebug => BOOLEAN\nDebug value to pass to Net::NNTP, see Net::NNTP\n\nHost => HOSTNAME|Net::NNTP object\nName of NNTP server to connect to, or a Net::NNTP object to use.\n\nPort => INTEGER\nPort number to connect to on remote host\n\n$obj->reply(%options)\nCreate a new object with header initialised for a reply to the current object. And the body\nwill be a copy of the current message indented.\n\nThe \".mailhdr\" file in your home directory (if exists) will be read first, to provide\ndefaults.\n\n-Option  --Default\nExclude   []\nIndent    '>'\nKeep      []\nReplyAll  false\n\nExclude => ARRAY-of-FIELDS\nRemove the listed FIELDS from the produced message.\n\nIndent => STRING\nUse as indentation string. The string may contain \"%%\" to get a single \"%\", %f to get the\nfirst from name, %F is the first character of %f, %l is the last name, %L its first\ncharacter, %n the whole from string, and %I the first character of each of the names in\nthe from string.\n\nKeep => ARRAY-of-FIELDS\nCopy the listed FIELDS from the original message.\n\nReplyAll => BOOLEAN\nAutomatically include all To and Cc addresses of the original mail, excluding those\nmentioned in the Bcc list.\n\n$obj->send( [$type, [$args...]] )\nSend a Mail::Internet message using Mail::Mailer. $type and $args are passed on to\nMail::Mailer::new().\n\n$obj->smtpsend( [%options] )\nSend a Mail::Internet message using direct SMTP to the given ADDRESSES, each can be either a\nstring or a reference to a list of email addresses. If none of \"To\", <Cc> or \"Bcc\" are given\nthen the addresses are extracted from the message being sent.\n\nThe return value will be a list of email addresses that the message was sent to. If the\nmessage was not sent the list will be empty.\n\nRequires Net::SMTP and Net::Domain to be installed.\n\n-Option  --Default\nBcc       undef\nCc        undef\nDebug     <false>\nHello     localhost.localdomain\nHost      $ENV{SMTPHOSTS}\nMailFrom  Mail::Util::mailaddress()\nPort      25\nTo        undef\n\nBcc => ADDRESSES\nCc => ADDRESSES\nDebug => BOOLEAN\nDebug value to pass to Net::SMTP, see <Net::SMTP>\n\nHello => STRING\nSend a HELO (or EHLO) command to the server with the given name.\n\nHost => HOSTNAME\nName of the SMTP server to connect to, or a Net::SMTP object to use\n\nIf \"Host\" is not given then the SMTP host is found by attempting connections first to\nhosts specified in $ENV{SMTPHOSTS}, a colon separated list, then \"mailhost\" and\n\"localhost\".\n\nMailFrom => ADDRESS\nThe e-mail address which is used as sender. By default, Mail::Util::mailaddress() provides\nthe address of the sender.\n\nPort => INTEGER\nPort number to connect to on remote host\n\nTo => ADDRESSES\n\n$obj->unescapefrom(())\nRemove the escaping added by escapefrom().\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "This module is part of the MailTools distribution, http://perl.overmeer.net/mailtools/.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance\nwithout commitment to further development.\n\nMail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>.\nMail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>. For other contributors see\nChangeLog.\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2017 Mark Overmeer\n<perl@overmeer.net>.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://www.perl.com/perl/misc/Artistic.html\n",
                "subsections": []
            }
        }
    }
}