1Email::MIME::Header::AdUdsreerssCLoinsttr(i3b)uted PerlEDmoaciulm:e:nMtIaMtEi:o:nHeader::AddressList(3)
2
3
4
6 Email::MIME::Header::AddressList
7
9 version 1.949
10
12 my $address1 = Email::Address::XS->new('Name1' => 'address1@host.com');
13 my $address2 = Email::Address::XS->new("Name2 \N{U+263A}" => 'address2@host.com');
14 my $mime_address = Email::Address::XS->new('=?UTF-8?B?TmFtZTIg4pi6?=' => 'address2@host.com');
15
16 my $list1 = Email::MIME::Header::AddressList->new($address1, $address2);
17
18 $list1->append_groups('undisclosed-recipients' => []);
19
20 $list1->first_address();
21 # returns $address1
22
23 $list1->groups();
24 # returns (undef, [ $address1, $address2 ], 'undisclosed-recipients', [])
25
26 $list1->as_string();
27 # returns 'Name1 <address1@host.com>, "Name2 ☺" <address2@host.com>, undisclosed-recipients:;'
28
29 $list1->as_mime_string();
30 # returns 'Name1 <address1@host.com>, =?UTF-8?B?TmFtZTIg4pi6?= <address2@host.com>, undisclosed-recipients:;'
31
32 my $list2 = Email::MIME::Header::AddressList->new_groups(Group => [ $address1, $address2 ]);
33
34 $list2->append_addresses($address2);
35
36 $list2->addresses();
37 # returns ($address2, $address1, $address2)
38
39 $list2->groups();
40 # returns (undef, [ $address2 ], 'Group', [ $address1, $address2 ])
41
42 my $list3 = Email::MIME::Header::AddressList->new_mime_groups('=?UTF-8?B?4pi6?=' => [ $mime_address ]);
43 $list3->as_string();
44 # returns '☺: "Name2 ☺" <address2@host.com>;'
45
46 my $list4 = Email::MIME::Header::AddressList->from_string('Name1 <address1@host.com>, "Name2 ☺" <address2@host.com>, undisclosed-recipients:;');
47 my $list5 = Email::MIME::Header::AddressList->from_string('Name1 <address1@host.com>', '"Name2 ☺" <address2@host.com>', 'undisclosed-recipients:;');
48
49 my $list6 = Email::MIME::Header::AddressList->from_mime_string('Name1 <address1@host.com>, =?UTF-8?B?TmFtZTIg4pi6?= <address2@host.com>, undisclosed-recipients:;');
50 my $list7 = Email::MIME::Header::AddressList->from_mime_string('Name1 <address1@host.com>', '=?UTF-8?B?TmFtZTIg4pi6?= <address2@host.com>', 'undisclosed-recipients:;');
51
53 This module implements object representation for the list of the
54 Email::Address::XS objects. It provides methods for RFC 2047
55 <https://tools.ietf.org/html/rfc2047> MIME encoding and decoding
56 suitable for RFC 2822 <https://tools.ietf.org/html/rfc2822> address-
57 list structure.
58
59 EXPORT
60 None
61
62 Class Methods
63 new_empty
64 Construct new empty "Email::MIME::Header::AddressList" object.
65
66 new Construct new "Email::MIME::Header::AddressList" object from list
67 of Email::Address::XS objects.
68
69 new_groups
70 Construct new "Email::MIME::Header::AddressList" object from named
71 groups of Email::Address::XS objects.
72
73 new_mime_groups
74 Like "new_groups" but in this method group names and objects
75 properties are expected to be already MIME encoded, thus ASCII
76 strings.
77
78 from_string
79 Construct new "Email::MIME::Header::AddressList" object from input
80 string arguments. Calls Email::Address::XS::parse_email_groups.
81
82 from_mime_string
83 Like "from_string" but input string arguments are expected to be
84 already MIME encoded.
85
86 Object Methods
87 as_string
88 Returns string representation of "Email::MIME::Header::AddressList"
89 object. Calls Email::Address::XS::format_email_groups.
90
91 as_mime_string
92 Like "as_string" but output string will be properly and
93 unambiguously MIME encoded. MIME encoding is done before calling
94 Email::Address::XS::format_email_groups.
95
96 first_address
97 Returns first Email::Address::XS object.
98
99 addresses
100 Returns list of all Email::Address::XS objects.
101
102 groups
103 Like "addresses" but returns objects with named groups.
104
105 append_addresses
106 Append Email::Address::XS objects.
107
108 append_groups
109 Like "append_addresses" but arguments are pairs of name of group
110 and array reference of Email::Address::XS objects.
111
113 Email::MIME::Header::AddressList - MIME support for list of
114 Email::Address::XS objects
115
117 RFC 2047 <https://tools.ietf.org/html/rfc2047>, RFC 2822
118 <https://tools.ietf.org/html/rfc2822>, Email::MIME, Email::Address::XS
119
121 Pali <pali@cpan.org>
122
124 • Ricardo SIGNES <rjbs@cpan.org>
125
126 • Casey West <casey@geeknest.com>
127
128 • Simon Cozens <simon@cpan.org>
129
131 This software is copyright (c) 2004 by Simon Cozens and Casey West.
132
133 This is free software; you can redistribute it and/or modify it under
134 the same terms as the Perl 5 programming language system itself.
135
136
137
138perl v5.34.0 2021-07-22Email::MIME::Header::AddressList(3)