Email::...essList(3)
π NAME π
ok so bestie, you're looking at Email::MIME::Header::AddressList β it's the MIME support for a whole list of Email::Address::XS objects. like, one address? cute. a whole list with groups and MIME encoding? that's the main character energy we're serving here π
β¨ VERSION β¨
version 1.954 β yes, she's on 1.954, she's thriving, no cap.
π¦ SYNOPSIS π¦
okay, here's the whole vibe in code, and bestie I kept it character for character because that's the whole point:
my $address1 = Email::Address::XS->new('Name1' => 'address1@host.com');
my $address2 = Email::Address::XS->new("Name2 \N{U+263A}" => 'address2@host.com');
my $mime_address = Email::Address::XS->new('=?UTF-8?B?TmFtZTIg4pi6?=' => 'address2@host.com');
my $list1 = Email::MIME::Header::AddressList->new($address1, $address2);
$list1->append_groups('undisclosed-recipients' => []);
$list1->first_address();
# returns $address1
$list1->groups();
# returns (undef, [ $address1, $address2 ], 'undisclosed-recipients', [])
$list1->as_string();
# returns 'Name1 <address1@host.com>, "Name2 βΊ" <address2@host.com>, undisclosed-recipients:;'
$list1->as_mime_string();
# returns 'Name1 <address1@host.com>, =?UTF-8?B?TmFtZTIg4pi6?= <address2@host.com>, undisclosed-recipients:;'
my $list2 = Email::MIME::Header::AddressList->new_groups(Group => [ $address1, $address2 ]);
$list2->append_addresses($address2);
$list2->addresses();
# returns ($address2, $address1, $address2)
$list2->groups();
# returns (undef, [ $address2 ], 'Group', [ $address1, $address2 ])
my $list3 = Email::MIME::Header::AddressList->new_mime_groups('=?UTF-8?B?4pi6?=' => [ $mime_address ]);
$list3->as_string();
# returns 'βΊ: "Name2 βΊ" <address2@host.com>;'
my $list4 = Email::MIME::Header::AddressList->from_string('Name1 <address1@host.com>, "Name2 βΊ" <address2@host.com>, undisclosed-recipients:;');
my $list5 = Email::MIME::Header::AddressList->from_string('Name1 <address1@host.com>', '"Name2 βΊ" <address2@host.com>', 'undisclosed-recipients:;');
my $list6 = Email::MIME::Header::AddressList->from_mime_string('Name1 <address1@host.com>, =?UTF-8?B?TmFtZTIg4pi6?= <address2@host.com>, undisclosed-recipients:;');
my $list7 = Email::MIME::Header::AddressList->from_mime_string('Name1 <address1@host.com>', '=?UTF-8?B?TmFtZTIg4pi6?= <address2@host.com>', 'undisclosed-recipients:;');
see how the βΊ survives?? iconic. π
π DESCRIPTION π
so this module is literally the object representation for a list of Email::Address::XS objects. like it takes your little address babies and holds them all together in one gorgeous container.
it gives you methods for RFC 2047 (<https://tools.ietf.org/html/rfc2047>) MIME encoding and decoding β and those are suitable for the RFC 2822 (<https://tools.ietf.org/html/rfc2822>) address-list structure. so the encoding/decoding is doing the work so you don't have to, periodt. π
πΈ EXPORT πΈ
None. that's it. nothing exported. she gives you nothing and she's still the moment. π«Ά
π Class Methods π
okay so these are the "make a new one" methods, the birthing suite if you will:
new_emptyβ constructs a brand new emptyEmail::MIME::Header::AddressListobject. blank slate, fresh start, main character origin story β¨newβ constructs a newEmail::MIME::Header::AddressListobject from a list ofEmail::Address::XSobjects. hand her your addresses, she'll make it cute.new_groupsβ constructs a newEmail::MIME::Header::AddressListobject from named groups ofEmail::Address::XSobjects. now they're in little friend groups πnew_mime_groupsβ same energy asnew_groups, except in this method the group names and the objects' properties are expected to be already MIME encoded, so they're ASCII strings. iykyk β don't double-encode, bestie πfrom_stringβ constructs a newEmail::MIME::Header::AddressListobject from the input string arguments. it callsEmail::Address::XS::parse_email_groupsto do the parsing β¨from_mime_stringβ likefrom_string, but the input string arguments are expected to be already MIME encoded.
π¦ Object Methods π¦
and these are the "what can she do" methods, the moment she gets to shine:
as_stringβ returns the string representation of theEmail::MIME::Header::AddressListobject. callsEmail::Address::XS::format_email_groups. π₯as_mime_stringβ likeas_string, but the output string comes back properly and unambiguously MIME encoded. the MIME encoding happens before callingEmail::Address::XS::format_email_groups. obsessed with the ordering ngl πfirst_addressβ returns the firstEmail::Address::XSobject. first is the worst, but here she's the one you asked for πaddressesβ returns the list of all theEmail::Address::XSobjects. the whole squad πgroupsβ likeaddresses, but returns the objects with named groups. friend groups included, no extra charge π«Άappend_addressesβ appendsEmail::Address::XSobjects. more friends, more fun πappend_groupsβ likeappend_addresses, but the arguments are pairs of the name of the group and an array reference ofEmail::Address::XSobjects. so it'sname => [ ...addresses ], you got this π§
β PERL VERSION β
this library should run on perls released even a long time ago. like, she should work on any version of perl released in the last five years. π
although it may work on older versions of perl, there's no guarantee that the minimum required version won't be increased. the version may be increased for any reason, and there's no promise that patches will be accepted to lower the minimum required perl. so don't come for her about backwards compat, she said what she said π
π SEE ALSO π
go off, read more:
RFC 2047<https://tools.ietf.org/html/rfc2047>RFC 2822<https://tools.ietf.org/html/rfc2822>Email::MIMEEmail::Address::XS
π AUTHOR π
Pali <pali@cpan.org> β the icon who made this happen π
π AUTHORS π
Ricardo SIGNES<cpan@semiotic.systems>Casey West<casey@geeknest.com>Simon Cozens<simon@cpan.org>
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2004 by Simon Cozens and Casey West. π«Ά
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.
and that's the whole page bestie! π this one came to you courtesy ofperl v5.42.0, dated2024-05-03, and the header up top got a lil squished intoEmail::...essList(3)β but you and me both know the real name isEmail::MIME::Header::AddressList. mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Email-MIME 1.954.0-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms