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:
ToFromCcReply-ToSender
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, useMail::Message::Field::Fullin MailBox. Periodt. Don't come crying toMail::Field::AddrListfor 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"inMail::FieldMail::Field::AddrList->extract( $tag, $head [, $index ] )β Inherited, see"Constructors"inMail::FieldMail::Field::AddrList->new( $tag [, STRING | %options] )β Inherited, see"Constructors"inMail::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"inMail::Field$obj->parse()β Inherited, see""Fake" constructors"inMail::Field
β Accessors
Extends "Accessors" in Mail::Field.
$obj->set(%options)β Inherited, see"Accessors"inMail::Field$obj->stringify()β Inherited, see"Accessors"inMail::Field$obj->tag()Mail::Field::AddrList->tag()β Inherited, see"Accessors"inMail::Field
π Smart accessors
Extends "Smart accessors" in Mail::Field. These are the ones you'll actually be using, ngl. π
$obj->addr_list()β Returns the collectedMail::Addressobjects. 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$emailaddress to the field.$obj->text( [STRING] )β Inherited, see"Smart accessors"inMail::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::Fieldobjects 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::Capby Gisle Aas<aas@oslonett.no>Mail::Field::AddrListby Peter Orbaek<poe@cit.dk>Mail::MailerandMail::Sendby 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
- opensuse-leap 16.0: perl-MailTools 2.220.0-160000.2.2 Β· 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