Mail::M...:Address(3)
π NAME π
Mail::Message::Field::Address β literally just one e-mail address. That's it, that's the whole job. One (1) address, all wrapped up in an object so you don't have to do the character-set gymnastics yourself. We're in the User Contributed Perl Documentation corner of the manual, bestie π
𧬠INHERITANCE π§¬
Mail::Message::Field::Address
is a Mail::Identity
is a User::Identity::Item
So yeah, it's giving legacy. It inherits from Mail::Identity, which inherits from User::Identity::Item. Family tree ate π
β¨ SYNOPSIS β¨
my $addr = Mail::Message::Field::Address->new(...);
my $ui = User::Identity->new(...);
my $addr = Mail::Message::Field::Address->coerce($ui);
my $mi = Mail::Identity->new(...);
my $addr = Mail::Message::Field::Address->coerce($mi);
print $addr->address;
print $addr->fullName; # possibly unicode!
print $addr->domain;
Look at her go. Make one, coerce one, print the bits. That # possibly unicode! comment is doing so much emotional labor btw β heads up, that fullName can absolutely be unicode, no cap.
πΈ DESCRIPTION πΈ
So many header fields can contain e-mail addresses, and honestly? Each one of those addresses can be represented by an object of this class. These objects will handle interpretation and character set encoding and decoding for you. You don't lift a finger. Iconic behavior fr fr π«Ά
Extends "DESCRIPTION" in Mail::Identity.
π¦ OVERLOADED π¦
- overload:
""stringification β when the object gets used in string context, it returns the encoded representation of the e-mail address, exactly likestring()does. Same energy, different door. - overload: boolean true/falase β the object used as a boolean will always return
"true". Always. It's a yes-girl. (And yes bestie,falaseis spelled that way up in the source, I don't make the rules π) - overload:
cmpstring comparison β two address objects are the same when their email addresses are the same. Periodt.
π METHODS π
Extends "METHODS" in Mail::Identity.
π Constructors π
Extends "Constructors" in Mail::Identity.
$obj->coerce( <STRING|$object>, %options )β try to coerce the$objectinto aMail::Message::Field::Address. If it's a"STRING", it gets interpreted as an email address. The%optionsare passed to the object creation and they overrule the values found in the$object. The result may beundefor a newly created object. And if$objectis already the correct type? It gets returned unmodified, untouched, no notes. The$objectmay currently be aMail::Address, aMail::Identity, or aUser::Identityβ and in the last case, one of the user's addresses is chosen at random π² (chaos, but make it official).$class->new( [$name], %options )β inherited, see "Constructors" in Mail::Identity.$obj->parse(STRING)β parse the string for an address. And here's the tea: you never know whether one or more addresses are specified on a line (often applications are wrong π), therefore the"STRING"is first parsed for as many addresses as possible and then the one is taken at random.
π Attributes π
Extends "Attributes" in Mail::Identity.
$obj->address()β inherited, see "Attributes" in Mail::Identity.$obj->charset()β inherited, see "Attributes" in Mail::Identity.$obj->comment( [STRING] )β inherited, see "Attributes" in Mail::Identity.$obj->description()β inherited, see "Attributes" in User::Identity::Item.$obj->domain()β inherited, see "Attributes" in Mail::Identity.$obj->language()β inherited, see "Attributes" in Mail::Identity.$obj->location()β inherited, see "Attributes" in Mail::Identity.$obj->name( [$newname] )β inherited, see "Attributes" in User::Identity::Item.$obj->organization()β inherited, see "Attributes" in Mail::Identity.$obj->phrase()β inherited, see "Attributes" in Mail::Identity.$obj->username()β inherited, see "Attributes" in Mail::Identity.
π§ Collections π§
Extends "Collections" in Mail::Identity.
$obj->add($collection, $role)β inherited, see "Collections" in User::Identity::Item.$obj->addCollection( $object | <[$type], %options> )β inherited, see "Collections" in User::Identity::Item.$obj->collection($name)β inherited, see "Collections" in User::Identity::Item.$obj->parent( [$parent] )β inherited, see "Collections" in User::Identity::Item.$obj->removeCollection($object|$name)β inherited, see "Collections" in User::Identity::Item.$any->type()β inherited, see "Collections" in User::Identity::Item.$obj->user()β inherited, see "Collections" in User::Identity::Item.
π Searching π
Extends "Searching" in Mail::Identity.
$obj->find($collection, $role)β inherited, see "Searching" in User::Identity::Item.
π Accessors π
$obj->encoding()β character-set encoding, like'q'and'b', to be used when non-ascii characters are to be transmitted.
π Access to the content π
$obj->string()β returns an RFC compliant e-mail address, which will have character set encoding if needed. The objects are also overloaded to call this method in string context.
Β» example:
print $address->string;
print $address; # via overloading
π DIAGNOSTICS π
- Error: cannot coerce a
$typeinto a$classβ when addresses are specified to be included in header fields, they may be coerced intoMail::Message::Field::Addressobjects first. What you specify is not accepted as address specification. This may be an internal error. Cast bycoerce(). - Error: cannot load collection module for
$type($class):$@β either the specified$typedoes not exist, or that module named$classreturns compilation errors. If the type as specified in the warning is not the name of a package, you specified a nickname which was not defined. Maybe you forgot the'require'the package which defines the nickname. Cast byaddCollection(). - Error: invalid collection
$name. β the collection with$namedoes not exist and can not be created. Cast byadd(). - Error: this
$objectis not a collection. β cast byaddCollection().
π₯ SEE ALSO π₯
This module is part of Mail-Message version 4.04, built on February 04, 2026. Website: http://perl.overmeer.net/CPAN/ β go look, it's right there π«Ά
π LICENSE π
For contributors see file ChangeLog.
This software is copyright (c) 2001-2026 by Mark Overmeer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Slay, honestly. π
Okay bestie that's the whole page!! Signing off with perl v5.42.0 and the date 2026-02-05 β this was Mail::M...:Address(3), one e-mail address, zero regrets, mwah πβ¨π¦
π¦ where this page comes from
- fedora 44: perl-Mail-Message 4.04-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms