1Mail::Message::Field::AUdsderresCso(n3t)ributed Perl DocMuamieln:t:aMteisosnage::Field::Address(3)
2
3
4

NAME

6       Mail::Message::Field::Address - One e-mail address
7

INHERITANCE

9        Mail::Message::Field::Address
10          is a Mail::Identity
11          is an User::Identity::Item
12

SYNOPSIS

14        my $addr = Mail::Message::Field::Address->new(...);
15
16        my $ui   = User::Identity->new(...);
17        my $addr = Mail::Message::Field::Address->coerce($ui);
18
19        my $mi   = Mail::Identity->new(...);
20        my $addr = Mail::Message::Field::Address->coerce($mi);
21
22        print $addr->address;
23        print $addr->fullName;   # possibly unicode!
24        print $addr->domain;
25

DESCRIPTION

27       Many header fields can contain e-mail addresses.  Each e-mail address
28       can be represented by an object of this class.  These objects will han‐
29       dle interpretation and character set encoding and decoding for you.
30

OVERLOADED

32       overload: boolean
33
34           The object used as boolean will always return "true"
35
36       overload: stringification
37
38           When the object is used in string context, it will return the
39           encoded representation of the e-mail address, just like string()
40           does.
41

METHODS

43       Constructors
44
45       $obj->coerce(STRING⎪OBJECT, OPTIONS)
46
47           Try to coerce the OBJECT into a "Mail::Message::Field::Address".
48           In case of a STRING, it is interpreted as an email address.
49
50           The OPTIONS are passed to the object creation, and overrule the
51           values found in the OBJECT.  The result may be "undef" or a newly
52           created object.  If the OBJECT is already of the correct type, it
53           is returned unmodified.
54
55           The OBJECT may currently be a Mail::Address, a Mail::Identity, or a
56           User::Identity.  In case of the latter, one of the user's addresses
57           is chosen at random.
58
59       $obj->from(OBJECT)
60
61           See "Constructors" in Mail::Identity
62
63       Mail::Message::Field::Address->new([NAME], OPTIONS)
64
65           See "METHODS" in Mail::Identity
66
67       $obj->parse(STRING)
68
69           Parse the string for an address.  You never know whether one or
70           more addresses are specified on a line (often applications are
71           wrong), therefore, the STRING is first parsed for as many addresses
72           as possible and then the one is taken at random.
73
74       Attributes
75
76       $obj->address
77
78           See "Attributes" in Mail::Identity
79
80       $obj->charset
81
82           See "Attributes" in Mail::Identity
83
84       $obj->comment([STRING])
85
86           See "Attributes" in Mail::Identity
87
88       $obj->description
89
90           See "Attributes" in User::Identity::Item
91
92       $obj->domain
93
94           See "Attributes" in Mail::Identity
95
96       $obj->language
97
98           See "Attributes" in Mail::Identity
99
100       $obj->location
101
102           See "Attributes" in Mail::Identity
103
104       $obj->name([NEWNAME])
105
106           See "Attributes" in User::Identity::Item
107
108       $obj->organization
109
110           See "Attributes" in Mail::Identity
111
112       $obj->phrase
113
114           See "Attributes" in Mail::Identity
115
116       $obj->username
117
118           See "Attributes" in Mail::Identity
119
120       Collections
121
122       $obj->add(COLLECTION, ROLE)
123
124           See "Collections" in User::Identity::Item
125
126       $obj->addCollection(OBJECT ⎪ ([TYPE], OPTIONS))
127
128           See "Collections" in User::Identity::Item
129
130       $obj->collection(NAME)
131
132           See "Collections" in User::Identity::Item
133
134       $obj->find(COLLECTION, ROLE)
135
136           See "Collections" in User::Identity::Item
137
138       $obj->parent([PARENT])
139
140           See "Collections" in User::Identity::Item
141
142       $obj->removeCollection(OBJECT⎪NAME)
143
144           See "Collections" in User::Identity::Item
145
146       $obj->type
147
148       Mail::Message::Field::Address->type
149
150           See "Collections" in User::Identity::Item
151
152       $obj->user
153
154           See "Collections" in User::Identity::Item
155
156       Access to the content
157
158       $obj->string
159
160           Returns an RFC compliant e-mail address, which will have character
161           set encoding if needed.  The objects are also overloaded to call
162           this method in string context.
163
164           Example:
165
166            print $address->string;
167            print $address;          # via overloading
168

DIAGNOSTICS

170       Error: $object is not a collection.
171
172       The first argument is an object, but not of a class which extends
173       User::Identity::Collection.
174
175       Error: Cannot coerce a $type into a Mail::Message::Field::Address
176
177       When addresses are specified to be included in header fields, they may
178       be coerced into Mail::Message::Field::Address objects first.  What you
179       specify is not accepted as address specification.  This may be an
180       internal error.
181
182       Error: Cannot load collection module for $type ($class).
183
184       Either the specified $type does not exist, or that module named $class
185       returns compilation errors.  If the type as specified in the warning is
186       not the name of a package, you specified a nickname which was not
187       defined.  Maybe you forgot the 'require' the package which defines the
188       nickname.
189
190       Error: Creation of a collection via $class failed.
191
192       The $class did compile, but it was not possible to create an object of
193       that class using the options you specified.
194
195       Error: Don't know what type of collection you want to add.
196
197       If you add a collection, it must either by a collection object or a
198       list of options which can be used to create a collection object.  In
199       the latter case, the type of collection must be specified.
200
201       Warning: No collection $name
202
203       The collection with $name does not exist and can not be created.
204

SEE ALSO

206       This module is part of Mail-Box distribution version 2.070, built on
207       March 25, 2007. Website: http://perl.overmeer.net/mailbox/
208

LICENSE

210       Copyrights 2001-2007 by Mark Overmeer.For other contributors see
211       ChangeLog.
212
213       This program is free software; you can redistribute it and/or modify it
214       under the same terms as Perl itself.  See
215       http://www.perl.com/perl/misc/Artistic.html
216
217
218
219perl v5.8.8                       2007-03-25  Mail::Message::Field::Address(3)
Impressum