Parse an RFC 5322 address list
header value (To, Cc, Bcc, From, Reply-To, and friends) into its mailboxes.
Unlike parseEmailAddress, which implements the strict RFC 5321 envelope grammar, this accepts
everything a message header may carry: display names, quoted strings, nested comments, folding
whitespace, groups, domain literals, obsolete source routes, and multiple addresses. Malformed
entries are dropped rather than throwing, so a single broken address never costs you the rest of
the header.
A display name or a group name is never reported as an address. billing@example.com Jane <attacker@example.org> reads as one address, attacker@example.org, because only the angle-addr
names a real recipient, and billing@example.com: victim@example.org; reads as one address in a
group. Code that decides where mail goes must rely on this rather than on searching the header
for text that looks like an address.
constresult = parseEmailAddressList('Jane Doe <jane@example.org>, john@example.org'); // result is two entries, the first with `displayName: 'Jane Doe'`
Parse an RFC 5322 address list header value (
To,Cc,Bcc,From,Reply-To, and friends) into its mailboxes.Unlike
parseEmailAddress, which implements the strict RFC 5321 envelope grammar, this accepts everything a message header may carry: display names, quoted strings, nested comments, folding whitespace, groups, domain literals, obsolete source routes, and multiple addresses. Malformed entries are dropped rather than throwing, so a single broken address never costs you the rest of the header.A display name or a group name is never reported as an address.
billing@example.com Jane <attacker@example.org>reads as one address,attacker@example.org, because only the angle-addr names a real recipient, andbilling@example.com: victim@example.org;reads as one address in a group. Code that decides where mail goes must rely on this rather than on searching the header for text that looks like an address.