{
    "content": [
        {
            "type": "text",
            "text": "# Email::Valid (perldoc)\n\n## NAME\n\nEmail::Valid - Check validity of Internet email addresses\n\n## SYNOPSIS\n\nuse Email::Valid;\nmy $address = Email::Valid->address('maurice@hevanet.com');\nprint ($address ? 'yes' : 'no');\n\n## DESCRIPTION\n\nThis module determines whether an email address is well-formed, and optionally, whether a mail\nhost exists for the domain.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PREREQUISITES**\n- **METHODS**\n- **EXAMPLES**\n- **CREDITS**\n- **SEE ALSO**\n- **AUTHOR**\n- **CONTRIBUTORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Email::Valid",
        "section": "",
        "mode": "perldoc",
        "summary": "Email::Valid - Check validity of Internet email addresses",
        "synopsis": "use Email::Valid;\nmy $address = Email::Valid->address('maurice@hevanet.com');\nprint ($address ? 'yes' : 'no');",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "Let's see if the address 'maurice@hevanet.com' conforms to the RFC822 specification:",
            "print (Email::Valid->address('maurice@hevanet.com') ? 'yes' : 'no');",
            "Additionally, let's make sure there's a mail host for it:",
            "print (Email::Valid->address( -address => 'maurice@hevanet.com',",
            "-mxcheck => 1 ) ? 'yes' : 'no');",
            "Let's see an example of how the address may be modified:",
            "$addr = Email::Valid->address('Alfred Neuman <Neuman @ foo.bar>');",
            "print \"$addr\\n\"; # prints Neuman@foo.bar",
            "Now let's add the check for top level domains:",
            "$addr = Email::Valid->address( -address => 'Neuman@foo.bar',",
            "-tldcheck => 1 );",
            "print \"$addr\\n\"; # doesn't print anything",
            "Need to determine why an address failed?",
            "unless(Email::Valid->address('maurice@hevanet')) {",
            "print \"address failed $Email::Valid::Details check.\\n\";",
            "If an error is encountered, an exception is raised. This is really only possible when performing",
            "DNS queries. Trap any exceptions by wrapping the call in an eval block:",
            "eval {",
            "$addr = Email::Valid->address( -address => 'maurice@hevanet.com',",
            "-mxcheck => 1 );",
            "};",
            "warn \"an error was encountered: $@\" if $@;"
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "PREREQUISITES",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 93,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 35,
                "subsections": []
            },
            {
                "name": "CREDITS",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "CONTRIBUTORS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Email::Valid - Check validity of Internet email addresses\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 1.202\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Email::Valid;\nmy $address = Email::Valid->address('maurice@hevanet.com');\nprint ($address ? 'yes' : 'no');\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module determines whether an email address is well-formed, and optionally, whether a mail\nhost exists for the domain.\n\nPlease note that there is no way to determine whether an address is deliverable without\nattempting delivery (for details, see perlfaq 9\n<http://perldoc.perl.org/perlfaq9.html#How-do-I-check-a-valid-mail-address>).\n",
                "subsections": []
            },
            "PREREQUISITES": {
                "content": "This module requires perl 5.004 or later and the Mail::Address module. Either the Net::DNS\nmodule or the nslookup utility is required for DNS checks. The Net::Domain::TLD module is\nrequired to check the validity of top level domains.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "Every method which accepts an \"<ADDRESS>\" parameter may be passed either a string or an instance\nof the Mail::Address class. All errors raise an exception.\n\nnew ( [PARAMS] )\nThis method is used to construct an Email::Valid object. It accepts an optional list of\nnamed parameters to control the behavior of the object at instantiation.\n\nThe following named parameters are allowed. See the individual methods below for details.\n\n-mxcheck\n-tldcheck\n-fudge\n-fqdn\n-allowip\n-localrules\n\nmx ( <ADDRESS>|<DOMAIN> )\nThis method accepts an email address or domain name and determines whether a DNS record (A\nor MX) exists for it.\n\nThe method returns true if a record is found and undef if not.\n\nEither the Net::DNS module or the nslookup utility is required for DNS checks. Using\nNet::DNS is the preferred method since error handling is improved. If Net::DNS is available,\nyou can modify the behavior of the resolver (e.g. change the default tcptimeout value) by\nmanipulating the global Net::DNS::Resolver instance stored in $Email::Valid::Resolver.\n\nrfc822 ( <ADDRESS> )\nThis method determines whether an address conforms to the RFC822 specification (except for\nnested comments). It returns true if it conforms and undef if not.\n\nfudge ( <TRUE>|<FALSE> )\nSpecifies whether calls to address() should attempt to correct common addressing errors.\nCurrently, this results in the removal of spaces in AOL addresses, and the conversion of\ncommas to periods in Compuserve addresses. The default is false.\n\nallowip ( <TRUE>|<FALSE> )\nSpecifies whether a \"domain literal\" is acceptable as the domain part. That means addresses\nlike: \"rjbs@[1.2.3.4]\"\n\nThe checking for the domain literal is stricter than the RFC and looser than checking for a\nvalid IP address, *but this is subject to change*.\n\nThe default is true.\n\nfqdn ( <TRUE>|<FALSE> )\nSpecifies whether addresses passed to address() must contain a fully qualified domain name\n(FQDN). The default is true.\n\nPlease note! FQDN checks only occur for non-domain-literals. In other words, if you have set\n\"allowip\" and the address ends in a bracketed IP address, the FQDN check will not occur.\n\ntld ( <ADDRESS> )\nThis method determines whether the domain part of an address is in a recognized top-level\ndomain.\n\nPlease note! TLD checks only occur for non-domain-literals. In other words, if you have set\n\"allowip\" and the address ends in a bracketed IP address, the TLD check will not occur.\n\nlocalrules ( <TRUE>|<FALSE> )\nSpecifies whether addresses passed to address() should be tested for domain specific\nrestrictions. Currently, this is limited to certain AOL restrictions that I'm aware of. The\ndefault is false.\n\nmxcheck ( <TRUE>|<FALSE> )\nSpecifies whether addresses passed to address() should be checked for a valid DNS entry. The\ndefault is false.\n\ntldcheck ( <TRUE>|<FALSE> )\nSpecifies whether addresses passed to address() should be checked for a valid top level\ndomains. The default is false.\n\naddress ( <ADDRESS> )\nThis is the primary method which determines whether an email address is valid. Its behavior\nis modified by the values of mxcheck(), tldcheck(), localrules(), fqdn(), and fudge(). If\nthe address passes all checks, the (possibly modified) address is returned as a string.\nOtherwise, undef is returned. In a list context, the method also returns an instance of the\nMail::Address class representing the email address.\n\ndetails ()\nIf the last call to address() returned undef, you can call this method to determine why it\nfailed. Possible values are:\n\nrfc822\nlocalpart\nlocalrules\nfqdn\nmxcheck\ntldcheck\n\nIf the class is not instantiated, you can get the same information from the global\n$Email::Valid::Details.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "Let's see if the address 'maurice@hevanet.com' conforms to the RFC822 specification:\n\nprint (Email::Valid->address('maurice@hevanet.com') ? 'yes' : 'no');\n\nAdditionally, let's make sure there's a mail host for it:\n\nprint (Email::Valid->address( -address => 'maurice@hevanet.com',\n-mxcheck => 1 ) ? 'yes' : 'no');\n\nLet's see an example of how the address may be modified:\n\n$addr = Email::Valid->address('Alfred Neuman <Neuman @ foo.bar>');\nprint \"$addr\\n\"; # prints Neuman@foo.bar\n\nNow let's add the check for top level domains:\n\n$addr = Email::Valid->address( -address => 'Neuman@foo.bar',\n-tldcheck => 1 );\nprint \"$addr\\n\"; # doesn't print anything\n\nNeed to determine why an address failed?\n\nunless(Email::Valid->address('maurice@hevanet')) {\nprint \"address failed $Email::Valid::Details check.\\n\";\n}\n\nIf an error is encountered, an exception is raised. This is really only possible when performing\nDNS queries. Trap any exceptions by wrapping the call in an eval block:\n\neval {\n$addr = Email::Valid->address( -address => 'maurice@hevanet.com',\n-mxcheck => 1 );\n};\nwarn \"an error was encountered: $@\" if $@;\n",
                "subsections": []
            },
            "CREDITS": {
                "content": "Significant portions of this module are based on the ckaddr program written by Tom Christiansen\nand the RFC822 address pattern developed by Jeffrey Friedl. Neither were involved in the\nconstruction of this module; all errors are mine.\n\nThanks very much to the following people for their suggestions and bug fixes:\n\nOtis Gospodnetic <otis@DOMINIS.com>\nKim Ryan <kimaryan@ozemail.com.au>\nPete Ehlke <pde@listserv.music.sony.com>\nLupe Christoph\nDavid Birnbaum\nAchim\nElizabeth Mattijsen (liz@dijkmat.nl)\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Mail::Address, Net::DNS, Net::Domain::TLD, perlfaq9\n<https://metacpan.org/pod/distribution/perlfaq/lib/perlfaq9.pod>\n\nRFC822 <https://www.ietf.org/rfc/rfc0822.txt> - standard for the format of ARPA internet text\nmessages. Superseded by RFC2822 <https://www.ietf.org/rfc/rfc2822.txt>.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Maurice Aubrey <maurice@hevanet.com>\n",
                "subsections": []
            },
            "CONTRIBUTORS": {
                "content": "*   Alexandr Ciornii <alexchorny@gmail.com>\n\n*   Karel Miko <karel.miko@gmail.com>\n\n*   McA <McA@github.com>\n\n*   Michael Schout <mschout@gkg.net>\n\n*   Mohammad S Anwar <mohammad.anwar@yahoo.com>\n\n*   Neil Bowers <neil@bowers.com>\n\n*   Ricardo SIGNES <rjbs@cpan.org>\n\n*   Steve Bertrand <steveb@cpan.org>\n\n*   Svetlana <svetlana.wiczer@gmail.com>\n\n*   Troy Morehouse <troymore@nbnet.nb.ca>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "This software is copyright (c) 1998 by Maurice Aubrey.\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": []
            }
        }
    }
}