{
    "mode": "perldoc",
    "parameter": "Net::IMAP::SimpleX",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3AIMAP%3A%3ASimpleX/json",
    "generated": "2026-06-14T05:25:17Z",
    "synopsis": "use strict;\nuse warnings;\nuse Net::IMAP::SimpleX;\nNet::IMAP::SimpleX uses Net::IMAP::Simple as a base so the object creation is the same as it is\nfor the ancestor:\nmy $imap = Net::IMAP::SimpleX->new('imap.example.com') ||\ndie \"Unable to connect to IMAP: $Net::IMAP::Simple::errstr\\n\";\n$imap->select(\"INBOX\");\nNet::IMAP::SimpleX is a collection of handy methods that are not simple, require\nParse::RecDescent, or are experimental.",
    "sections": {
        "NAME": {
            "content": "Net::IMAP::SimpleX - Addons for Net::IMAP::Simple\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use strict;\nuse warnings;\nuse Net::IMAP::SimpleX;\n\nNet::IMAP::SimpleX uses Net::IMAP::Simple as a base so the object creation is the same as it is\nfor the ancestor:\n\nmy $imap = Net::IMAP::SimpleX->new('imap.example.com') ||\ndie \"Unable to connect to IMAP: $Net::IMAP::Simple::errstr\\n\";\n\n$imap->select(\"INBOX\");\n\nNet::IMAP::SimpleX is a collection of handy methods that are not simple, require\nParse::RecDescent, or are experimental.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module adds some useful, yet not so simple, extensions on top of Net::IMAP::Simple.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "new For details on the invocation, read Net::IMAP::Simple.\n\nbodysummary\nTypical invocations will take this overall shape.\n\n# get an object representation of the message body\nmy $summary = $imap->bodysummary($messagenumber);\n\n# multipart message\nif ($summary->hasparts) {\nfor my $subpart ($summary->parts) {\nif ($subpart->hasparts) { ... }\n# examine the message part\nmy @attr = map { $subpart->$ } qw/contenttype encoding encodedsize/;\n# fetch the raw message part\nmy $subpartbody = $imap->get($messagenumber, $subpart->partnumber);\n}\n} else {\nmy $body = $summary->body;\nmy @attr = map { $body->$ } qw/contenttype encoding encodedsize/\n}\n\nThis method returns a simple object that contains a representation of the body of a message.\nThe object is built by a Parse::RecDescent parser using the output of an IMAP *fetch body*\ncommand. The parser uses the formal syntax as defined by RFC3501\n<http://tools.ietf.org/html/rfc3501#section-9>.\n\nmy $body = $summary->body;\nmy @attr = map { $body->$ } qw/\ncontentdescription\nencodedsize\ncharset\ncontenttype\npartnumber\nformat\nid\nencoding\n/;\n\nFor multipart messages, the object contains sub-objects for each message part, accessible\nvia the parts() method and inspected via the hasparts() method. The type method describes\nthe type of multipart (such as mixed or alternative). The parts method returns a list of sub\nparts, which themselves may have subparts, and so on.\n\nAn example of a multipart, alternative message with a text body and an html version of the\nbody would looke something like:\n\nif ($summary->hasparts) {\nif ($summary->type eq 'alternative') {\nmy ($html) = grep { $->contenttype eq 'text/html' } $summary->parts;\n}\n}\n\nA really complex, multipart message could look something like this:\n\nif ($summary->hasparts && $summary->type eq 'mixed') {\n\nfor my $part ($summary->parts) {\nif ($part->hasparts && $part->type eq 'mixed') { ... }\n...\n}\n\n}\n\nfetch\nThe fetch command returns the various parts of messages that users request. It is fairly\ncomplicated (following RFC3501 using a grammar/parser), but there are some basic patterns\nthat it follows.\n\nmy $res  =$imap->fetch('30:32' => 'UID BODY.PEEK[HEADER.FIELDS (DATE)] FLAGS')\n# $res = {\n#   30 => {\n#           \"BODY[HEADER.FIELDS (DATE)]\" => \"Date: Sun, 18 Jul 2010 20:54:48 -0400\\r\\n\\r\\n\",\n#           \"FLAGS\" => [\"\\\\Flagged\", \"\\\\Seen\"],\n#           \"UID\" => 58890,\n#         },\n#   31 => {\n#           \"BODY[HEADER.FIELDS (DATE)]\" => \"Date: Wed, 21 Jul 2010 09:09:04 -0400\\r\\n\\r\\n\",\n#           \"FLAGS\" => [\"\\\\Seen\"],\n#           \"UID\" => 58891,\n#         },\n#   32 => {\n#           \"BODY[HEADER.FIELDS (DATE)]\" => \"Date: Sat, 24 Jul 2010 05:12:06 -0700\\r\\n\\r\\n\",\n#           \"FLAGS\" => [\"\\\\Seen\"],\n#           \"UID\" => 58892,\n#         },\n# }\n\nSo-called \"parenthized\" lists will be returned as an array (see \"FLAGS\") but nearly\neverything else will come back as strings. This includes parenthized queries. Take\n\"BODY.PEAK[HEADER.FIELDS (DATE FROM SUBJECT)]\"), for example. The result would come back as\nthe RFC822 header lines (as the above \"Date: Sun, ...\" has done).\n\nFor more information about the different types of queries, see RFC3501. There's a surprising\nnumber of things that can be queried.\n\nuidfetch\nThis is roughly the same thing as the \"fetch()\" method above, but the query runs on UIDs\ninstead of sequence numbers. The keys of the $res are still the sequence numbers though.\n\nmy $res  =$imap->fetch('58890' => 'UID BODY.PEEK[HEADER.FIELDS (DATE)] FLAGS')\n# $res = {\n#   30 => {\n#           \"BODY[HEADER.FIELDS (DATE)]\" => \"Date: Sun, 18 Jul 2010 20:54:48 -0400\\r\\n\\r\\n\",\n#           \"FLAGS\" => [\"\\\\Flagged\", \"\\\\Seen\"],\n#           \"UID\" => 58890,\n#         },\n#   ...\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "INITIAL AUTHOR\nJason Woodward \"<woodwardj@jaos.org>\"\n\nADDITIONAL CONTRIBUTIONS\nPaul Miller \"<jettero@cpan.org>\" [*fetch()*]\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright (c) 2010 Jason Woodward\n\nAll rights reserved. This program is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "This module is free software. You can redistribute it and/or modify it under the terms of the\nArtistic License 2.0.\n\nThis program is distributed in the hope that it will be useful, but without any warranty;\nwithout even the implied warranty of merchantability or fitness for a particular purpose.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "<https://rt.cpan.org/Dist/Display.html?Queue=Net-IMAP-Simple>\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "perl, Net::IMAP::Simple, Parse::RecDescent\n",
            "subsections": []
        }
    },
    "summary": "Net::IMAP::SimpleX - Addons for Net::IMAP::Simple",
    "flags": [],
    "examples": [],
    "see_also": []
}