Email::MIME::Header::AddressList(3pm)

Email::MIME::Header::AddressList3pm

Mime support for list of email::address::xs objects

Usage

  my $address1 = Email::Address::XS->new('Name1' => '[email protected]');
  my $address2 = Email::Address::XS->new("Name2 \N{U+263A}" => '[email protected]');
  my $mime_address = Email::Address::XS->new('=?UTF-8?B?TmFtZTIg4pi6?=' => '[email protected]');
  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 <[email protected]>, "Name2 ☺" <[email protected]>, undisclosed-recipients:;'
  $list1->as_mime_string();
  # returns 'Name1 <[email protected]>, =?UTF-8?B?TmFtZTIg4pi6?= <[email protected]>, 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 ☺" <[email protected]>;'
  my $list4 = Email::MIME::Header::AddressList->from_string('Name1 <[email protected]>, "Name2 ☺" <[email protected]>, undisclosed-recipients:;');
  my $list5 = Email::MIME::Header::AddressList->from_string('Name1 <[email protected]>', '"Name2 ☺" <[email protected]>', 'undisclosed-recipients:;');
  my $list6 = Email::MIME::Header::AddressList->from_mime_string('Name1 <[email protected]>, =?UTF-8?B?TmFtZTIg4pi6?= <[email protected]>, undisclosed-recipients:;');
  my $list7 = Email::MIME::Header::AddressList->from_mime_string('Name1 <[email protected]>', '=?UTF-8?B?TmFtZTIg4pi6?= <[email protected]>', 'undisclosed-recipients:;');

Version

version 1.954

Overview

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.

Export

None

Class Methods

new_empty

Construct new empty "Email::MIME::Header::AddressList" object.

new

Construct new "Email::MIME::Header::AddressList" object from list of Email::Address::XS objects.

new_groups

Construct new "Email::MIME::Header::AddressList" object from named groups of Email::Address::XS objects.

new_mime_groups

Like "new_groups" but in this method group names and objects properties are expected to be already MIME encoded, thus ASCII strings.

from_string

Construct new "Email::MIME::Header::AddressList" object from input string arguments. Calls Email::Address::XS::parse_email_groups.

from_mime_string

Like "from_string" but input string arguments are expected to be already MIME encoded.

Object Methods

as_string

Returns string representation of "Email::MIME::Header::AddressList" object. Calls Email::Address::XS::format_email_groups.

as_mime_string

Like "as_string" but output string will be properly and unambiguously MIME encoded. MIME encoding is done before calling Email::Address::XS::format_email_groups.

first_address

Returns first Email::Address::XS object.

addresses

Returns list of all Email::Address::XS objects.

groups

Like "addresses" but returns objects with named groups.

append_addresses

Append Email::Address::XS objects.

append_groups

Like "append_addresses" but arguments are pairs of name of group and array reference of Email::Address::XS objects.

Perl version

This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years.

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.

Releases

5 releases since Debian 10 (Buster); the text changed 4 times.

  1. 10
  2. 11
  3. 12
  4. 13
  5. Arch