Scroll to navigation

Email::MIME::Header::AddressList(3) User Contributed Perl Documentation Email::MIME::Header::AddressList(3)


Email::MIME::Header::AddressList - MIME support for list of Email::Address::XS objects


version 1.954


  my $address1 = Email::Address::XS->new('Name1' => '');
  my $address2 = Email::Address::XS->new("Name2 \N{U+263A}" => '');
  my $mime_address = Email::Address::XS->new('=?UTF-8?B?TmFtZTIg4pi6?=' => '');
  my $list1 = Email::MIME::Header::AddressList->new($address1, $address2);
  $list1->append_groups('undisclosed-recipients' => []);
  # returns $address1
  # returns (undef, [ $address1, $address2 ], 'undisclosed-recipients', [])
  # returns 'Name1 <>, "Name2 ☺" <>, undisclosed-recipients:;'
  # returns 'Name1 <>, =?UTF-8?B?TmFtZTIg4pi6?= <>, undisclosed-recipients:;'
  my $list2 = Email::MIME::Header::AddressList->new_groups(Group => [ $address1, $address2 ]);
  # returns ($address2, $address1, $address2)
  # returns (undef, [ $address2 ], 'Group', [ $address1, $address2 ])
  my $list3 = Email::MIME::Header::AddressList->new_mime_groups('=?UTF-8?B?4pi6?=' => [ $mime_address ]);
  # returns '☺: "Name2 ☺" <>;'
  my $list4 = Email::MIME::Header::AddressList->from_string('Name1 <>, "Name2 ☺" <>, undisclosed-recipients:;');
  my $list5 = Email::MIME::Header::AddressList->from_string('Name1 <>', '"Name2 ☺" <>', 'undisclosed-recipients:;');
  my $list6 = Email::MIME::Header::AddressList->from_mime_string('Name1 <>, =?UTF-8?B?TmFtZTIg4pi6?= <>, undisclosed-recipients:;');
  my $list7 = Email::MIME::Header::AddressList->from_mime_string('Name1 <>', '=?UTF-8?B?TmFtZTIg4pi6?= <>', 'undisclosed-recipients:;');


This module implements object representation for the list of the Email::Address::XS objects. It provides methods for RFC 2047 <> MIME encoding and decoding suitable for RFC 2822 <> address-list structure.



Class Methods

Construct new empty "Email::MIME::Header::AddressList" object.
Construct new "Email::MIME::Header::AddressList" object from list of Email::Address::XS objects.
Construct new "Email::MIME::Header::AddressList" object from named groups of Email::Address::XS objects.
Like "new_groups" but in this method group names and objects properties are expected to be already MIME encoded, thus ASCII strings.
Construct new "Email::MIME::Header::AddressList" object from input string arguments. Calls Email::Address::XS::parse_email_groups.
Like "from_string" but input string arguments are expected to be already MIME encoded.

Object Methods

Returns string representation of "Email::MIME::Header::AddressList" object. Calls Email::Address::XS::format_email_groups.
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.
Returns first Email::Address::XS object.
Returns list of all Email::Address::XS objects.
Like "addresses" but returns objects with named groups.
Append Email::Address::XS objects.
Like "append_addresses" but arguments are pairs of name of group and array reference of Email::Address::XS objects.


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.


RFC 2047 <>, RFC 2822 <>, Email::MIME, Email::Address::XS


Pali <>


  • Ricardo SIGNES <>
  • Casey West <>
  • Simon Cozens <>


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.

2024-05-03 perl v5.40.0