parseAddresses
Reads an email address list into records with name and email.
Details #
parseAddresses(text) reads a list such as Jane Smith <[email protected]>, [email protected] (the To or Cc line of an email) into a list of records with name and email. Commas and semicolons inside quotes ("Smith, Jane" <[email protected]>) or angle brackets do not split the list, and a mailto: prefix is dropped.
Parameters #
Takes 1 argument.
{{ parseAddresses(text) }}
Examples #
parseAddresses("Jane Smith <[email protected]>, [email protected]")→
[
{
"email" : "[email protected]",
"name" : "Jane Smith"
},
{
"email" : "[email protected]",
"name" : ""
}
]length(parseAddresses(header))→
2| Sample variable | Value |
|---|---|
header | Jane <[email protected]>, [email protected] |
Gotchas #
It never fails: pieces that are not an address are skipped, and no text gives an empty list.