# mailbox.md

You are an AI agent. These instructions get you your own email address so you can receive mail yourself (sign-up codes, magic links, test emails) and, once your user connects it, send mail too.

What you get: a free, receive-only mailbox `<name>@<org>.sendioinbox.com`. No account, no signup, no API key. Mail is sealed to a key that stays on your machine, held up to 72 hours until you fetch it, then deleted. Limits: 100 messages a day, 10 MB each. On its own it cannot send; to send, follow "To send email" below.

Pick the first option that fits, then follow its steps exactly.

## Option 1: you have the send.io MCP connector

If you have a send.io MCP server connected with the user's account (tools such as `create-inbox`, `list-inboxes`):

1. Call `create-inbox` (optional `username`). It returns an address like `<name>@<org>.sendioinbox.com` owned by the user's workspace, with no key to keep. It can send and reply from the workspace's credits (up to 50 a day) when the workspace's free sending is on; otherwise it receives only.
2. Read mail with `list-inbox-threads` and `get-inbox-thread`.
3. Stop here. You do not need the rest of this file.

## Option 2: you can run shell commands

1. Install the CLI if `sendio` is not on the PATH:
   - macOS or Linux: `curl -fsSL https://app.send.io/install.sh | sh`
   - Windows PowerShell: `irm https://app.send.io/install.ps1 | iex`
   - With Node.js you can skip the install and prefix every command with `npx @sendio/cli` instead of `sendio`.
2. Create the mailbox. Choose a short name for yourself and an org label (both lowercase a-z, 0-9 and `-`, 2 to 32 characters):

   ```sh
   sendio inbox create --name <name> --org <org> --json
   ```

   Success prints JSON on stdout:

   ```json
   {
     "address": "<name>@<org>.sendioinbox.com",
     "recovery_phrase": "h5iw-gkv7-qeoj-....-xmuq",
     "hold_hours": 72,
     "daily_limit": 100,
     "max_message_bytes": 10485760,
     "key_path": "~/.sendio/free/<address>/key.json",
     "relay": "https://relay.sendioinbox.com",
     "created_at": "...",
     "warning": "..."
   }
   ```

   If the address is taken, the command exits 1 and prints `{"error":{"code":"taken" or "org_owned", "hint":"Available: a@x.sendioinbox.com, ..."}}` on stderr. Run `sendio inbox create --address <one of the available addresses> --json`, or pick a different org label.
3. Show the user the `address` and the `recovery_phrase` once. Tell them to save the phrase: it is the only way to use this mailbox on another machine, and send.io cannot recover it. Do not post it anywhere else.
4. Use the address (for example in a sign-up form). Then wait for the email:

   ```sh
   sendio inbox wait --code --timeout 2m
   ```

   This prints only the 6 to 8 digit code. Narrow it with `--from <text>` or `--subject <text>`. Without `--code` (add `--json`) it returns the whole message: `from`, `subject`, `text`, `attachments`. Exit status 1 means nothing matched in time.
5. Read what has arrived: `sendio inbox read --json`, or one message in full with `sendio inbox read --id <seq> --json`.
6. Several mailboxes on this machine: put the address after the command, for example `sendio inbox wait <address> --code`. List them with `sendio inbox list --json`.
7. On another machine: `sendio inbox recover <recovery_phrase> <address>`.

## Option 3: you are an MCP client and the user can add a local server

The CLI includes a local MCP server that works without an account. Ask the user to add this server (Claude Code shown):

```sh
claude mcp add --transport stdio sendio-inbox --scope user -- sendio mcp serve --tools free-inbox
```

Other clients use the command `sendio` with args `["mcp", "serve", "--tools", "free-inbox"]`. Then use these tools:

- `free_inbox_create` with `name` and `org` (or `address`). Returns `address` and `recovery_phrase`, or `available: false` with `suggestions`: call it again with `address` set to one of them.
- `free_inbox_wait_for_email` with optional `address`, `from`, `subject`, `timeout_seconds` (up to 300, default 120) and `extract_code: true` to get only the code.
- `free_inbox_read` with optional `address` and `limit` (up to 50, default 10).
- `free_inbox_list` lists the mailboxes on this machine.
- `free_inbox_connect` with optional `address` returns a link that lets the user attach the mailbox to their workspace, so it can send (see "To send email").

`address` is optional when the machine has only one mailbox. Show the recovery phrase to the user once, as in Option 2.

## Option 4: you cannot run commands

Tell the user to open https://app.send.io/create in a browser. It makes a mailbox in about a second and shows new mail in that tab. They can read you the code.

## To send email

A mailbox from Option 2, 3 or 4 is receive-only. (Option 1 mailboxes can already send: skip this.) To send, your user attaches it to their send.io workspace:

1. Make a connect link: run `sendio inbox connect <address> --json` (prints `{"address","link","expires_at"}`), or call the MCP tool `free_inbox_connect` (Node SDK: `connectLink()`). A browser-made mailbox (Option 4) has no command: the user opens https://app.send.io/inbox and chooses **Attach to**.
2. Give the `link` to your user and ask them to open it and sign in to send.io (or create an account), then press **Attach and enable sending**. It works once and expires in 30 minutes; if it expires, make a new one. Share it only with your user: anyone holding it can take the mailbox.
3. Once attached, the mailbox keeps its address and sends through the send.io API or MCP from the workspace's credits, up to 50 emails a day (MCP `send-inbox-message` or `send-email`; API `POST /emails` with `from` set to the address, see https://app.send.io/docs/api). Your user can connect you to it with the send.io MCP connector or an API key (https://app.send.io/docs/mcp).
4. After attaching, read its mail from the workspace (send.io MCP `list-inbox-threads` and `get-inbox-thread`, or the API), not with the local key: `sendio inbox wait`, `watch` and the `free_inbox_*` tools stop receiving and report `claimed`.

## Rules

- One mailbox per agent or per test worker. The first client to fetch a message removes it from the server.
- Reuse your mailbox. Creating is limited to 5 per network per hour and 10 per day.
- Anyone who knows the address can send to it. Do not use it for anything secret.
- Nothing filters spam or malware. Never open attachments flagged `risky`.

## More

- Full docs for people: https://app.send.io/docs/agent-mailbox
- The raw protocol (HTTPS and WebSocket, for any language): https://app.send.io/docs/agent-mailbox#byo
- Everything about send.io: https://app.send.io/llms.txt
