# Email address list parse

`email-address-list-parse` · version 1.0.0 · Communications · free, no key needed

Parse an RFC 5322 address-list into ordered mailboxes, groups, and a canonical form.

**Use when you need to: parse an rfc 5322 address list · split mailboxes and groups from a recipient list · read display names out of a to header.**

## Decide before calling

Read the [versioned contract](/v1/tools/email-address-list-parse/versions/1.0.0) and the supported scope below. Reuse `email-address-list-parse@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `email-address-list-parse@1.0.0` for parse an rfc 5322 address list. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- parse an rfc 5322 address list
- split mailboxes and groups from a recipient list
- read display names out of a to header
- turn an address list into structured mailboxes
- rfc 5322 group syntax to addresses
- canonicalize a mailbox list and keep its order
- recover addr-spec from an address list

## Not supported

- deliver the message or look up a DNS MX record
- accept an obsolete source route
- prove that a mailbox exists

## Behavior

- Dot-atom-text is 1*atext *("." 1*atext) per RFC 5322 section 3.2.3, used by section 3.4.1. U+002E is not atext. A leading dot, a trailing dot, or two dots in a row is rejected in a local-part and in a domain, in both ascii and utf-8 modes. Inside a domain-literal or a quoted-string, a dot is ordinary text.
- mode ascii accepts only Unicode scalar values U+0000 through U+007F. mode utf-8 also treats U+0080 through U+10FFFF as atext, qtext, ctext, dtext and VCHAR, which is the RFC 6532 section 3.2 extension. The dot separator stays U+002E only.
- Canonical form drops comments and folding white space. A local-part that is a dot-atom is written unquoted; any other local-part is a quoted-string. A display name that is atoms separated by one space is written unquoted; otherwise it is a quoted-string. A mailbox with no display name is a bare addr-spec. Top-level addresses are joined by a comma and one space. Group members are joined by a comma with no space, with no space around the colon, and an empty group is name:; .
- Obsolete null list slots and source routes (obs-route) are rejected. Domain-literals are not interpreted as IP addresses. RFC 5321 length limits and the SMTP requirement for a dot in the domain are not applied.
- Output preserves the left-to-right order of top-level addresses and of members inside each group.
- The same text and mode always produce the same JSON. No clock, locale, or network.
- Disclaimer: format transform only; provides no confidentiality, integrity, or authenticity.

## Input

- `text` (string, required): min length 1; max length 2048
- `mode` (one of "ascii", "utf-8", required)

## Output

- `mode` (one of "ascii", "utf-8", required)
- `canonical` (string, required): min length 1; max length 8192
- `address_count` (integer, required): min 1; max 32
- `mailbox_count` (integer, required): min 0; max 32
- `group_count` (integer, required): min 0; max 32
- `addresses` (array of object or object, required): min items 1; max items 32

## Limits

- max input bytes: 2048
- max addresses: 32
- max groups: 32
- max comment depth: 8
- max output bytes: 65536

## Example

Request input:

```json
{
  "text": "Mary Smith <mary@x.test>, jdoe@example.org, Who? <one@y.test>",
  "mode": "ascii"
}
```

Response:

```json
{
  "result": {
    "mode": "ascii",
    "canonical": "Mary Smith <mary@x.test>, jdoe@example.org, Who? <one@y.test>",
    "address_count": 3,
    "mailbox_count": 3,
    "group_count": 0,
    "addresses": [
      {
        "kind": "mailbox",
        "display_name": "Mary Smith",
        "local_part": "mary",
        "domain": "x.test",
        "addr_spec": "mary@x.test"
      },
      {
        "kind": "mailbox",
        "display_name": "",
        "local_part": "jdoe",
        "domain": "example.org",
        "addr_spec": "jdoe@example.org"
      },
      {
        "kind": "mailbox",
        "display_name": "Who?",
        "local_part": "one",
        "domain": "y.test",
        "addr_spec": "one@y.test"
      }
    ]
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "email-address-list-parse",
  "version": "1.0.0",
  "input": {
    "text": "Mary Smith <mary@x.test>, jdoe@example.org, Who? <one@y.test>",
    "mode": "ascii"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/email-address-list-parse/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"text":"Mary Smith <mary@x.test>, jdoe@example.org, Who? <one@y.test>","mode":"ascii"}'
```

The machine-readable contract is at [/v1/tools/email-address-list-parse/versions/1.0.0](/v1/tools/email-address-list-parse/versions/1.0.0).

### CLI

```sh
node cli.mjs run email-address-list-parse 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Email address list format](/tools/email-address-list-format): Format mailboxes and groups as one deterministic RFC 5322 address-list.
- [Email address list deduplicate](/tools/email-address-list-deduplicate): Drop duplicate mailboxes in an RFC 5322 address-list, keeping the first one.
- [Email mailbox parse](/tools/email-mailbox-parse): Parse one RFC 5322 mailbox into parts and canonical text, without a delivery claim.
- [Email address list validate](/tools/email-address-list-validate): Check RFC 5322 address-list syntax, including dots, quotes, comments, and groups.
- [Email mailbox format](/tools/email-mailbox-format): Render a canonical RFC 5322 mailbox from decoded parts, without a delivery claim.
- [Email mailbox validate](/tools/email-mailbox-validate): Check one RFC 5322 mailbox for syntax only and return a stable reason code.
