{
    "mode": "perldoc",
    "parameter": "Mail::Message::Field::Address",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Mail%3A%3AMessage%3A%3AField%3A%3AAddress/json",
    "generated": "2026-06-09T20:53:12Z",
    "synopsis": "my $addr = Mail::Message::Field::Address->new(...);\nmy $ui   = User::Identity->new(...);\nmy $addr = Mail::Message::Field::Address->coerce($ui);\nmy $mi   = Mail::Identity->new(...);\nmy $addr = Mail::Message::Field::Address->coerce($mi);\nprint $addr->address;\nprint $addr->fullName;   # possibly unicode!\nprint $addr->domain;",
    "sections": {
        "NAME": {
            "content": "Mail::Message::Field::Address - One e-mail address\n",
            "subsections": []
        },
        "INHERITANCE": {
            "content": "Mail::Message::Field::Address\nis a Mail::Identity\nis a User::Identity::Item\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $addr = Mail::Message::Field::Address->new(...);\n\nmy $ui   = User::Identity->new(...);\nmy $addr = Mail::Message::Field::Address->coerce($ui);\n\nmy $mi   = Mail::Identity->new(...);\nmy $addr = Mail::Message::Field::Address->coerce($mi);\n\nprint $addr->address;\nprint $addr->fullName;   # possibly unicode!\nprint $addr->domain;\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Many header fields can contain e-mail addresses. Each e-mail address can be represented by an\nobject of this class. These objects will handle interpretation and character set encoding and\ndecoding for you.\n\nExtends \"DESCRIPTION\" in Mail::Identity.\n",
            "subsections": []
        },
        "OVERLOADED": {
            "content": "overload: boolean\nThe object used as boolean will always return \"true\"\n\noverload: string $comparison\nTwo address objects are the same when their email addresses are the same.\n\noverload: stringification\nWhen the object is used in string context, it will return the encoded representation of the\ne-mail address, just like string() does.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Extends \"METHODS\" in Mail::Identity.\n",
            "subsections": [
                {
                    "name": "Constructors",
                    "content": "Extends \"Constructors\" in Mail::Identity.\n\n$obj->coerce( <STRING|$object>, %options )\nTry to coerce the $object into a \"Mail::Message::Field::Address\". In case of a STRING, it is\ninterpreted as an email address.\n\nThe %options are passed to the object creation, and overrule the values found in the\n$object. The result may be \"undef\" or a newly created object. If the $object is already of\nthe correct type, it is returned unmodified.\n\nThe $object may currently be a Mail::Address, a Mail::Identity, or a User::Identity. In case\nof the latter, one of the user's addresses is chosen at random.\n\nMail::Message::Field::Address->new( [$name], %options )\nInherited, see \"Constructors\" in Mail::Identity\n\n$obj->parse(STRING)\nParse the string for an address. You never know whether one or more addresses are specified\non a line (often applications are wrong), therefore, the STRING is first parsed for as many\naddresses as possible and then the one is taken at random.\n"
                },
                {
                    "name": "Attributes",
                    "content": "Extends \"Attributes\" in Mail::Identity.\n\n$obj->address()\nInherited, see \"Attributes\" in Mail::Identity\n\n$obj->charset()\nInherited, see \"Attributes\" in Mail::Identity\n\n$obj->comment( [STRING] )\nInherited, see \"Attributes\" in Mail::Identity\n\n$obj->description()\nInherited, see \"Attributes\" in User::Identity::Item\n\n$obj->domain()\nInherited, see \"Attributes\" in Mail::Identity\n\n$obj->language()\nInherited, see \"Attributes\" in Mail::Identity\n\n$obj->location()\nInherited, see \"Attributes\" in Mail::Identity\n\n$obj->name( [$newname] )\nInherited, see \"Attributes\" in User::Identity::Item\n\n$obj->organization()\nInherited, see \"Attributes\" in Mail::Identity\n\n$obj->phrase()\nInherited, see \"Attributes\" in Mail::Identity\n\n$obj->username()\nInherited, see \"Attributes\" in Mail::Identity\n"
                },
                {
                    "name": "Collections",
                    "content": "Extends \"Collections\" in Mail::Identity.\n\n$obj->add($collection, $role)\nInherited, see \"Collections\" in User::Identity::Item\n\n$obj->addCollection( $object | <[$type], %options> )\nInherited, see \"Collections\" in User::Identity::Item\n\n$obj->collection($name)\nInherited, see \"Collections\" in User::Identity::Item\n\n$obj->parent( [$parent] )\nInherited, see \"Collections\" in User::Identity::Item\n\n$obj->removeCollection($object|$name)\nInherited, see \"Collections\" in User::Identity::Item\n\n$obj->type()\nMail::Message::Field::Address->type()\nInherited, see \"Collections\" in User::Identity::Item\n\n$obj->user()\nInherited, see \"Collections\" in User::Identity::Item\n"
                },
                {
                    "name": "Searching",
                    "content": "Extends \"Searching\" in Mail::Identity.\n\n$obj->find($collection, $role)\nInherited, see \"Searching\" in User::Identity::Item\n"
                },
                {
                    "name": "Accessors",
                    "content": "$obj->encoding()\nCharacter-set encoding, like 'q' and 'b', to be used when non-ascii characters are to be\ntransmitted.\n"
                },
                {
                    "name": "Access to the content",
                    "content": "$obj->string()\nReturns an RFC compliant e-mail address, which will have character set encoding if needed.\nThe objects are also overloaded to call this method in string context.\n\nexample:\n\nprint $address->string;\nprint $address;          # via overloading\n"
                }
            ]
        },
        "DIAGNOSTICS": {
            "content": "Error: $object is not a collection.\nThe first argument is an object, but not of a class which extends\nUser::Identity::Collection.\n\nError: Cannot coerce a $type into a Mail::Message::Field::Address\nWhen addresses are specified to be included in header fields, they may be coerced into\nMail::Message::Field::Address objects first. What you specify is not accepted as address\nspecification. This may be an internal error.\n\nError: Cannot load collection module for $type ($class).\nEither the specified $type does not exist, or that module named $class returns compilation\nerrors. If the type as specified in the warning is not the name of a package, you specified\na nickname which was not defined. Maybe you forgot the 'require' the package which defines\nthe nickname.\n\nError: Creation of a collection via $class failed.\nThe $class did compile, but it was not possible to create an object of that class using the\noptions you specified.\n\nError: Don't know what type of collection you want to add.\nIf you add a collection, it must either by a collection object or a list of options which\ncan be used to create a collection object. In the latter case, the type of collection must\nbe specified.\n\nWarning: No collection $name\nThe collection with $name does not exist and can not be created.\n",
            "subsections": []
        },
        "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": []
        }
    },
    "summary": "Mail::Message::Field::Address - One e-mail address",
    "flags": [],
    "examples": [],
    "see_also": []
}