Email::MIME::Header::AddressList(3pm) | User Contributed Perl Documentation | Email::MIME::Header::AddressList(3pm) |
Email::MIME::Header::AddressList - MIME support for list of Email::Address::XS objects
version 1.946
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:;');
This module implements object representation for the list of the Email::Address::XS objects. It provides methods for RFC 2047 <https://tools.ietf.org/html/rfc2047> MIME encoding and decoding suitable for RFC 2822 <https://tools.ietf.org/html/rfc2822> address-list structure.
None
Email::MIME::Header::AddressList - MIME support for list of Email::Address::XS objects
RFC 2047 <https://tools.ietf.org/html/rfc2047>, RFC 2822 <https://tools.ietf.org/html/rfc2822>, Email::MIME, Email::Address::XS
Pali <pali@cpan.org>
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.
2017-11-21 | perl v5.26.1 |