.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Mail::Message::Field::Address 3" .TH Mail::Message::Field::Address 3 2026-04-11 "perl v5.42.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Mail::Message::Field::Address \- One e\-mail address .SH INHERITANCE .IX Header "INHERITANCE" .Vb 3 \& Mail::Message::Field::Address \& is a Mail::Identity \& is a User::Identity::Item .Ve .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& 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; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Many header fields can contain e\-mail addresses. Each e\-mail address can be represented by an object of this class. These objects will handle interpretation and character set encoding and decoding for you. .PP Extends "DESCRIPTION" in Mail::Identity. .SH OVERLOADED .IX Header "OVERLOADED" .IP "overload: \fB\*(Aq""""\*(Aq\fR stringification" 4 .IX Item "overload: '""""' stringification" When the object is used in string context, it will return the encoded representation of the e\-mail address, just like \fBstring()\fR does. .IP "overload: \fB\*(Aqbool\*(Aq\fR use as boolean" 4 .IX Item "overload: 'bool' use as boolean" The object used as boolean will always return \f(CW\*(C`true\*(C'\fR .IP "overload: \fB\*(Aqcmp\*(Aq\fR string comparison" 4 .IX Item "overload: 'cmp' string comparison" Two address objects are the same when their email addresses are the same. .SH METHODS .IX Header "METHODS" Extends "METHODS" in Mail::Identity. .SS Constructors .IX Subsection "Constructors" Extends "Constructors" in Mail::Identity. .ie n .IP "$obj\->\fBcoerce\fR( , %options )" 4 .el .IP "\f(CW$obj\fR\->\fBcoerce\fR( , \f(CW%options\fR )" 4 .IX Item "$obj->coerce( , %options )" Try to coerce the \f(CW$object\fR into a \f(CW\*(C`Mail::Message::Field::Address\*(C'\fR. In case of a \f(CW\*(C`STRING\*(C'\fR, it is interpreted as an email address. .Sp The \f(CW%options\fR are passed to the object creation, and overrule the values found in the \f(CW$object\fR. The result may be \f(CW\*(C`undef\*(C'\fR or a newly created object. If the \f(CW$object\fR is already of the correct type, it is returned unmodified. .Sp The \f(CW$object\fR may currently be a Mail::Address, a Mail::Identity, or a User::Identity. In case of the latter, one of the user\*(Aqs addresses is chosen at random. .ie n .IP "$class\->\fBnew\fR( [$name], %options )" 4 .el .IP "\f(CW$class\fR\->\fBnew\fR( [$name], \f(CW%options\fR )" 4 .IX Item "$class->new( [$name], %options )" Inherited, see "Constructors" in Mail::Identity .ie n .IP $obj\->\fBparse\fR(STRING) 4 .el .IP \f(CW$obj\fR\->\fBparse\fR(STRING) 4 .IX Item "$obj->parse(STRING)" Parse the string for an address. You never know whether one or more addresses are specified on a line (often applications are wrong), therefore, the \f(CW\*(C`STRING\*(C'\fR is first parsed for as many addresses as possible and then the one is taken at random. .SS Attributes .IX Subsection "Attributes" Extends "Attributes" in Mail::Identity. .ie n .IP $obj\->\fBaddress\fR() 4 .el .IP \f(CW$obj\fR\->\fBaddress\fR() 4 .IX Item "$obj->address()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBcharset\fR() 4 .el .IP \f(CW$obj\fR\->\fBcharset\fR() 4 .IX Item "$obj->charset()" Inherited, see "Attributes" in Mail::Identity .ie n .IP "$obj\->\fBcomment\fR( [STRING] )" 4 .el .IP "\f(CW$obj\fR\->\fBcomment\fR( [STRING] )" 4 .IX Item "$obj->comment( [STRING] )" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBdescription\fR() 4 .el .IP \f(CW$obj\fR\->\fBdescription\fR() 4 .IX Item "$obj->description()" Inherited, see "Attributes" in User::Identity::Item .ie n .IP $obj\->\fBdomain\fR() 4 .el .IP \f(CW$obj\fR\->\fBdomain\fR() 4 .IX Item "$obj->domain()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBlanguage\fR() 4 .el .IP \f(CW$obj\fR\->\fBlanguage\fR() 4 .IX Item "$obj->language()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBlocation\fR() 4 .el .IP \f(CW$obj\fR\->\fBlocation\fR() 4 .IX Item "$obj->location()" Inherited, see "Attributes" in Mail::Identity .ie n .IP "$obj\->\fBname\fR( [$newname] )" 4 .el .IP "\f(CW$obj\fR\->\fBname\fR( [$newname] )" 4 .IX Item "$obj->name( [$newname] )" Inherited, see "Attributes" in User::Identity::Item .ie n .IP $obj\->\fBorganization\fR() 4 .el .IP \f(CW$obj\fR\->\fBorganization\fR() 4 .IX Item "$obj->organization()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBphrase\fR() 4 .el .IP \f(CW$obj\fR\->\fBphrase\fR() 4 .IX Item "$obj->phrase()" Inherited, see "Attributes" in Mail::Identity .ie n .IP $obj\->\fBusername\fR() 4 .el .IP \f(CW$obj\fR\->\fBusername\fR() 4 .IX Item "$obj->username()" Inherited, see "Attributes" in Mail::Identity .SS Collections .IX Subsection "Collections" Extends "Collections" in Mail::Identity. .ie n .IP "$obj\->\fBadd\fR($collection, $role)" 4 .el .IP "\f(CW$obj\fR\->\fBadd\fR($collection, \f(CW$role\fR)" 4 .IX Item "$obj->add($collection, $role)" Inherited, see "Collections" in User::Identity::Item .ie n .IP "$obj\->\fBaddCollection\fR( $object | <[$type], %options> )" 4 .el .IP "\f(CW$obj\fR\->\fBaddCollection\fR( \f(CW$object\fR | <[$type], \f(CW%options\fR> )" 4 .IX Item "$obj->addCollection( $object | <[$type], %options> )" Inherited, see "Collections" in User::Identity::Item .ie n .IP $obj\->\fBcollection\fR($name) 4 .el .IP \f(CW$obj\fR\->\fBcollection\fR($name) 4 .IX Item "$obj->collection($name)" Inherited, see "Collections" in User::Identity::Item .ie n .IP "$obj\->\fBparent\fR( [$parent] )" 4 .el .IP "\f(CW$obj\fR\->\fBparent\fR( [$parent] )" 4 .IX Item "$obj->parent( [$parent] )" Inherited, see "Collections" in User::Identity::Item .ie n .IP $obj\->\fBremoveCollection\fR($object|$name) 4 .el .IP \f(CW$obj\fR\->\fBremoveCollection\fR($object|$name) 4 .IX Item "$obj->removeCollection($object|$name)" Inherited, see "Collections" in User::Identity::Item .ie n .IP $any\->\fBtype\fR() 4 .el .IP \f(CW$any\fR\->\fBtype\fR() 4 .IX Item "$any->type()" Inherited, see "Collections" in User::Identity::Item .ie n .IP $obj\->\fBuser\fR() 4 .el .IP \f(CW$obj\fR\->\fBuser\fR() 4 .IX Item "$obj->user()" Inherited, see "Collections" in User::Identity::Item .SS Searching .IX Subsection "Searching" Extends "Searching" in Mail::Identity. .ie n .IP "$obj\->\fBfind\fR($collection, $role)" 4 .el .IP "\f(CW$obj\fR\->\fBfind\fR($collection, \f(CW$role\fR)" 4 .IX Item "$obj->find($collection, $role)" Inherited, see "Searching" in User::Identity::Item .SS Accessors .IX Subsection "Accessors" .ie n .IP $obj\->\fBencoding\fR() 4 .el .IP \f(CW$obj\fR\->\fBencoding\fR() 4 .IX Item "$obj->encoding()" Character\-set encoding, like \*(Aqq\*(Aq and \*(Aqb\*(Aq, to be used when non\-ascii characters are to be transmitted. .SS "Access to the content" .IX Subsection "Access to the content" .ie n .IP $obj\->\fBstring\fR() 4 .el .IP \f(CW$obj\fR\->\fBstring\fR() 4 .IX Item "$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. .Sp ยป example: .Sp .Vb 2 \& print $address\->string; \& print $address; # via overloading .Ve .SH DIAGNOSTICS .IX Header "DIAGNOSTICS" .ie n .IP "Error: cannot coerce a $type into a $class" 4 .el .IP "Error: cannot coerce a \f(CW$type\fR into a \f(CW$class\fR" 4 .IX Item "Error: cannot coerce a $type into a $class" When addresses are specified to be included in header fields, they may be coerced into Mail::Message::Field::Address objects first. What you specify is not accepted as address specification. This may be an internal error. Cast by \f(CWcoerce()\fR .ie n .IP "Error: cannot load collection module for $type ($class): $@" 4 .el .IP "Error: cannot load collection module for \f(CW$type\fR ($class): $@" 4 .IX Item "Error: cannot load collection module for $type ($class): $@" Either the specified \f(CW$type\fR does not exist, or that module named \f(CW$class\fR returns 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 \*(Aqrequire\*(Aq the package which defines the nickname. Cast by \f(CWaddCollection()\fR .ie n .IP "Error: invalid collection $name." 4 .el .IP "Error: invalid collection \f(CW$name\fR." 4 .IX Item "Error: invalid collection $name." The collection with \f(CW$name\fR does not exist and can not be created. Cast by \f(CWadd()\fR .ie n .IP "Error: this $object is not a collection." 4 .el .IP "Error: this \f(CW$object\fR is not a collection." 4 .IX Item "Error: this $object is not a collection." Cast by \f(CWaddCollection()\fR .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of Mail\-Message version 4.05, built on April 10, 2026. Website: \fIhttp://perl.overmeer.net/mailbox/\fR .SH LICENSE .IX Header "LICENSE" For contributors see file ChangeLog. .PP This software is copyright (c) 2001\-2026 by Mark Overmeer. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.