Mail::F...AddrList(3)

πŸ’Œ NAME πŸ’Œ

Okay so Mail::Field::AddrList β€” literally an object representation of e-mail address lists. That's the whole vibe. Bestie, it's the thing that takes a header full of names and addresses and makes it make sense. πŸŽ€

This page lives in the User Contributed Perl Documentation section of the manual (section 3, iykyk), so yeah β€” Perl module docs, we're in it. πŸ’…


🌸 INHERITANCE 🌸

Mail::Field::AddrList
  is a Mail::Field

So it's a child of Mail::Field. It inherits the whole family's energy. πŸ‘‘


✨ SYNOPSIS ✨

Here's the whole flex, verbatim, no cap:

use Mail::Field::AddrList;

$to   = Mail::Field->new('To');
$from = Mail::Field->new('From', 'poe@daimi.aau.dk (Peter Orbaek)');

$from->create('foo@bar.com' => 'Mr. Foo', poe => 'Peter');
$from->parse('foo@bar.com (Mr Foo), Peter Orbaek <poe>');

# make a RFC822 header string
print $from->stringify(),"\n";

# extract e-mail addresses and names
@addresses = $from->addresses(); # strings
@names     = $from->names();     # strings
@addr      = $from->addr_list(); # Mail::Address objects (v2.00)

# adjoin a new address to the list
$from->set_address('foo@bar.com', 'Mr. Foo');

Like, look at it. Creating fields, parsing them, stringifying them back out, pulling addresses and names, and adding new ones. It's giving full lifecycle. Obsessed. πŸ¦‹


🫢 DESCRIPTION 🫢

So what this module actually does: it defines the parsing and formatting of address fields β€” specifically these ones:

  • To
  • From
  • Cc
  • Reply-To
  • Sender

All the normally used features of the address field spec from RFC2822 are implemented. But β€” and this is important, bestie β€” some of the complex (and therefore hardly ever used) constructs will not be understood. Lowkey it's just not built for the weird stuff.

If you need full RFC compliance, use Mail::Message::Field::Full in MailBox. Periodt. Don't come crying to Mail::Field::AddrList for the fancy edge cases. 🧚

It also extends "DESCRIPTION" in Mail::Field.


πŸ”₯ METHODS πŸ”₯

Extends "METHODS" in Mail::Field.

πŸŽ€ Constructors

Extends "Constructors" in Mail::Field.

  • Mail::Field::AddrList->combine($fields) β€” Inherited, see "Constructors" in Mail::Field
  • Mail::Field::AddrList->extract( $tag, $head [, $index ] ) β€” Inherited, see "Constructors" in Mail::Field
  • Mail::Field::AddrList->new( $tag [, STRING | %options] ) β€” Inherited, see "Constructors" in Mail::Field

πŸ’€ "Fake" constructors

Extends ""Fake" constructors" in Mail::Field. Yes, "Fake" is in quotes in the original, and yes we're keeping the quotes. The audacity. πŸ™ˆ

  • $obj->create(%options) β€” Inherited, see ""Fake" constructors" in Mail::Field
  • $obj->parse() β€” Inherited, see ""Fake" constructors" in Mail::Field

⭐ Accessors

Extends "Accessors" in Mail::Field.

  • $obj->set(%options) β€” Inherited, see "Accessors" in Mail::Field
  • $obj->stringify() β€” Inherited, see "Accessors" in Mail::Field
  • $obj->tag()
  • Mail::Field::AddrList->tag() β€” Inherited, see "Accessors" in Mail::Field

πŸ‘‘ Smart accessors

Extends "Smart accessors" in Mail::Field. These are the ones you'll actually be using, ngl. 🌈

  • $obj->addr_list() β€” Returns the collected Mail::Address objects. Real objects, not just strings. Main character energy. πŸ¦‹
  • $obj->addresses() β€” Returns a list if email addresses, found in the field content. (That's "list if" as in "list of" in the original β€” we're keeping it, it's part of the charm. 😭)
  • $obj->names() β€” Returns a list of nicely formatted named, for each of the addresses found in the content. (Again, "named" β€” verbatim, bestie. We don't fix. We preserve. πŸ’…)
  • $obj->set_address($email, $name) β€” Add/replace an $email address to the field.
  • $obj->text( [STRING] ) β€” Inherited, see "Smart accessors" in Mail::Field

πŸ“ DETAILS πŸ“

Extends "DETAILS" in Mail::Field. That's it. That's the section. Short king. πŸ‘‘


🧚 DIAGNOSTICS 🧚

  • Error: Undefined subroutine <method> called β€” Okay so Mail::Field objects use autoloading to compile new functionality. Apparently, the method called is not implemented for the specific class of the field object. Translation: you asked for a method that doesn't exist for this kind of field. Don't blame the module, blame the method name. πŸ’€

🌟 SEE ALSO 🌟

This module is part of the MailTools distribution, at http://perl.overmeer.net/mailtools/. Go look, it's cute. ✨


πŸ’– AUTHORS πŸ’–

The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development. (Read that: he's holding it down, but no promises about the future. Respect. 🫢)

Individual credits, and these are exact, don't come for me:

  • Mail::Cap by Gisle Aas <aas@oslonett.no>
  • Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>
  • Mail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>
  • For other contributors see ChangeLog

πŸŽ€ LICENSE πŸŽ€

Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2024 Mark Overmeer <perl@overmeer.net>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html. Slay, open source. πŸ’œ


Alright bestie, that's the whole page β€” every option, every inherited method, every email address, all of it. 🌸

And for the cute sign-off: this is the Mail::F...AddrList(3) page as shipped with perl v5.42.0, dated 2024-12-12. Iconic. Periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from