# Email address list format

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

Format mailboxes and groups as one deterministic RFC 5322 address-list.

**Use when you need to: format an rfc 5322 address list · render structured mailboxes as a recipient list · write a canonical to header from mailboxes and groups.**

## Decide before calling

Read the [versioned contract](/v1/tools/email-address-list-format/versions/1.0.0) and the supported scope below. Reuse `email-address-list-format@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-format@1.0.0` for format 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

- format an rfc 5322 address list
- render structured mailboxes as a recipient list
- write a canonical to header from mailboxes and groups
- quote a display name for an address list
- serialize groups and addr-specs
- build an address list from mailbox parts

## Not supported

- parse free-form header text
- remove duplicate recipients
- send the formatted header

## 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:; .
- A domain that is not a dot-atom or a domain-literal, including a leading, trailing, or doubled dot, is invalid_input. A local-part that is not a dot-atom is quoted rather than rejected.
- The same structured input always produces the same text. No clock, locale, or network.
- Disclaimer: format transform only; provides no confidentiality, integrity, or authenticity.

## Input

- `mode` (one of "ascii", "utf-8", required)
- `addresses` (array of object or object, required): min items 1; max items 32

## Output

- `mode` (one of "ascii", "utf-8", required)
- `text` (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

## Limits

- max input bytes: 4096
- max addresses: 32
- max groups: 32
- max output bytes: 65536

## Example

Request input:

```json
{
  "mode": "ascii",
  "addresses": [
    {
      "kind": "mailbox",
      "display_name": "Mary Smith",
      "local_part": "mary",
      "domain": "x.test"
    }
  ]
}
```

Response:

```json
{
  "result": {
    "mode": "ascii",
    "text": "Mary Smith <mary@x.test>",
    "address_count": 1,
    "mailbox_count": 1,
    "group_count": 0
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "email-address-list-format",
  "version": "1.0.0",
  "input": {
    "mode": "ascii",
    "addresses": [
      {
        "kind": "mailbox",
        "display_name": "Mary Smith",
        "local_part": "mary",
        "domain": "x.test"
      }
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/email-address-list-format/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"mode":"ascii","addresses":[{"kind":"mailbox","display_name":"Mary Smith","local_part":"mary","domain":"x.test"}]}'
```

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

### CLI

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

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

## Related tools

- [Email address list parse](/tools/email-address-list-parse): Parse an RFC 5322 address-list into ordered mailboxes, groups, and a canonical form.
- [Email mailbox format](/tools/email-mailbox-format): Render a canonical RFC 5322 mailbox from decoded parts, without a delivery claim.
- [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 validate](/tools/email-mailbox-validate): Check one RFC 5322 mailbox for syntax only and return a stable reason code.
