# Importing old mail

inboxy only ever receives mail sent to your `@inboxy.net` addresses. If you want your AI agent to work through email you already have somewhere else — years of shop orders in Gmail, say — you can **import** it. Imported messages are stored, classified and indexed for search exactly like inbound mail, so `mail_search`, `mail_get` and `mail_summarise` cover them.

We never connect to your other mailbox. You choose the files and push them.

## What import does — and doesn't do

- Each message is filed under **one of your addresses** (you pick which). Its original headers are kept.
- It is **never forwarded** to your personal email, whatever it looks like, and never appears in the daily digest. It lands as already-read.
- Its **retention clock starts on the day you import it**, not on the message's own date — a 2024 email imported today is kept as long as mail that arrived today. The inbox still orders it by its original date.
- Mail **you sent** from your personal address is accepted too, so whole conversations stay intact. It is marked as yours, and inboxy won't offer to reply to it (there's no sender to reply to).
- **Duplicates are harmless.** Messages are deduplicated on their `Message-ID`; re-uploading one is a no-op and doesn't count against the cap.
- Attachments come along and are stored with the message.

## Limits

| | Early Adopter (free) | Paid |
|---|---|---|
| Imports per UTC calendar month | 500 | 5,000 |
| Size per message | 10 MB | 10 MB |

The counter resets on the 1st of each month alongside the mail-send quota; `account_get` (MCP) and `GET /v1/account` (REST) show it under `quota.mail_import`.

## Three ways in

**Web** — Account → Import. Choose an address, drop up to 20 `.eml` files, done. Good for a handful of messages.

**Your agent** — the MCP tool `mail_import` takes an `address_id` and the message as base64 (6 MB cap on that path). Ask your agent to import a folder of `.eml` files and it will call the tool once per message.

**API** — for bulk backfills:

```sh
curl -X POST "https://api.inboxy.net/v1/mail/import?address_id=<your-address-id>" \
  -H "Authorization: Bearer ik_…" \
  -H "Content-Type: message/rfc822" \
  --data-binary @message.eml
```

`201` means stored; `200` with `"duplicate": true` means it was already there; `429` means the month's cap is spent (the body says when it resets). Your API key needs the `manage` scope. Loop it over a directory:

```sh
for f in *.eml; do
  curl -sS -X POST "https://api.inboxy.net/v1/mail/import?address_id=$ADDR" \
    -H "Authorization: Bearer $INBOXY_KEY" -H "Content-Type: message/rfc822" \
    --data-binary "@$f" -o /dev/null -w "$f %{http_code}\n"
done
```

## Getting `.eml` files

- **One message at a time:** most desktop mail clients save a message as `.eml` via drag-out to a folder or *File → Save as*. Gmail's web UI has *Download message* in the ⋮ menu.
- **A whole mailbox:** Google Takeout exports Gmail as one `.mbox` file. Split it into messages first — the `formail` tool from procmail does it in one line:

  ```sh
  mkdir eml && formail -s sh -c 'cat > eml/msg-$FILENO.eml' < All\ mail.mbox
  ```

  or, with Python only:

  ```sh
  python3 -c 'import mailbox,sys; [open(f"eml/{i}.eml","wb").write(m.as_bytes()) for i,m in enumerate(mailbox.mbox(sys.argv[1]))]' All\ mail.mbox
  ```

  Then filter to what you actually want your agent to see before uploading — the monthly cap is there so a 40,000-message archive is a deliberate, staged job rather than an accident.

## Privacy notes

Imported mail is your data like any other mail here: EU-resident storage, covered by your [export](/help/data-export-format) and delete rights, and purged by the same retention sweep once the import date ages out (or pinned with *keep* to exempt it). Classification and search indexing run on Cloudflare Workers AI in the same way as for inbound mail — see the [privacy policy](/privacy) for the processing detail.
