# Give Codex its own email address

Codex can have its own email address, such as `ada-research@botmail.pro`.
Paste one prompt to claim a Botmail mailbox, add the MCP server to
`~/.codex/config.toml`, and run `codex mcp login botmail`. The Codex CLI, the
IDE extension and Codex in the ChatGPT desktop app share that file, so you set
it up once and every Codex surface can read, send and wait for mail.

## Why Codex needs its own address

Codex is good at long, unattended tasks. An inbox gives it a way to report
back and to deal with the email those tasks create:

- **Tell you when it's done.** "Upgrade the dependencies, run the tests and
  email me what broke" means you don't have to keep checking the terminal.
- **Answer a vendor.** It can read the support thread about your API key and
  reply in the same conversation, so the vendor sees one consistent sender.
- **Receive verification codes.** It can sign up for a service you approve,
  wait for the code and carry on. See
  [verification emails](https://botmail.pro/guides/ai-agent-verification-emails).
- **Prepare outreach for review.** It writes a draft and gives you a review
  link instead of sending.

## 1. Claim a mailbox

Paste this into Codex:

```text
Read https://botmail.pro/skill.md and claim a mailbox for yourself. Send the invite to my email, then wait for me to approve it.
```

Codex's default sandbox has network access turned off, so it asks for your
approval before it runs the `curl` commands that claim the address. Approve
them. Codex asks for your email if it doesn't know it; open the email from
Botmail, sign in with GitHub or Google and accept. Unapproved mailboxes are
deleted after 24 hours.

The sandbox setting only affects shell commands. Once Botmail is connected
over MCP, Codex calls its tools directly.

## 2. Add Botmail to Codex

From your terminal:

```sh
codex mcp add botmail --url https://botmail.pro/mcp
```

That writes this to `~/.codex/config.toml`, which you can also add by hand:

```toml
[mcp_servers.botmail]
url = "https://botmail.pro/mcp"
```

To limit it to one repository, put the same table in `.codex/config.toml` in
that project instead. Codex only reads project config in trusted projects.

Then sign in:

```sh
codex mcp login botmail
```

Codex opens your browser. Botmail supports both ways Codex registers itself
(Client ID Metadata Documents and dynamic client registration), so there is
no client ID to create.

**In the ChatGPT desktop app:** open Settings, then MCP servers, and select
Add server. Name it `botmail`, choose Streamable HTTP, enter
`https://botmail.pro/mcp`, save and select Restart. Then select Authenticate
next to botmail. Type `/mcp` in the composer to see connected servers.

### Ask before Codex sends anything

Codex can prompt you before calling tools that change things. With `writes`,
it runs read-only tools such as `check_inbox` and `wait_for_mail` freely and
asks before `send_email`, `reply`, `forward` and other tools that aren't
marked read-only:

```toml
[mcp_servers.botmail]
url = "https://botmail.pro/mcp"
default_tools_approval_mode = "writes"
```

### Use an API key instead

Codex can send a Bearer token from an environment variable. Use the key your
agent saved when it claimed the mailbox:

```toml
[mcp_servers.botmail]
url = "https://botmail.pro/mcp"
bearer_token_env_var = "BOTMAIL_KEY"
```

Or add it that way from the start:

```sh
codex mcp add botmail --url https://botmail.pro/mcp --bearer-token-env-var BOTMAIL_KEY
```

## 3. Approve access

The browser shows a Botmail page. Sign in with GitHub or Google, then choose:

- **Permissions:** Read mail, Send mail and Manage (mailboxes, keys, webhooks
  and settings). Codex rarely needs Manage.
- **Mailboxes:** all, including future ones, or only the ones you tick.

Press Allow. You can revoke access later, and `codex mcp logout botmail`
removes the credentials Codex stored.

## Prompts to try

```text
Upgrade our dependencies and run the tests. When you're done, email me at you@example.com with what changed and anything that failed.
```

```text
Check your inbox for the Acme thread about our API key and draft a reply confirming we rotated it. Give me the review link.
```

```text
Use wait_for_mail to watch for the deploy confirmation from Render, then tell me what it says.
```

```text
Draft a short email to jane@example.com asking for access to their sandbox API. Don't send it; give me the review link.
```

Keep first contact with new people as drafts. Mail to new recipients is
checked for spam and phishing, and new accounts can email 25 new recipients a
day.

## Optional: install Botmail as a skill

Codex loads personal skills from `~/.agents/skills`. Botmail's
[skill.md](https://botmail.pro/skill.md) begins with skill front matter, so it installs as-is:

```sh
mkdir -p ~/.agents/skills/botmail
curl -s https://botmail.pro/skill.md -o ~/.agents/skills/botmail/SKILL.md
```

Invoke it with `$botmail`. Codex detects new skills automatically; restart it
if the skill doesn't appear.

## Troubleshooting

- **Check the server.** `codex mcp list` and `codex mcp get botmail` show
  what Codex loaded.
- **Sign-in fails during registration.** Retry with
  `codex mcp login botmail --oauth-client-registration dcr` to use dynamic
  client registration instead of a metadata document.
- **The desktop app doesn't show botmail.** Select Restart after saving the
  server; it reads `config.toml` on start.
- **Wrong account or old permissions.** Run `codex mcp logout botmail`, then
  log in again and pick new permissions.

Other clients are covered in [Email MCP server](https://botmail.pro/guides/email-mcp-server). New
to Botmail? Start with
[How to give your AI agent an email address](https://botmail.pro/guides/give-your-ai-agent-an-email-address).

## Questions

### How do I add an MCP server to Codex?

Run codex mcp add botmail --url https://botmail.pro/mcp, or add an [mcp_servers.botmail] table with url = "https://botmail.pro/mcp" to ~/.codex/config.toml. Then run codex mcp login botmail to sign in.

### Does the Codex IDE extension use the same MCP config as the CLI?

Yes. The Codex CLI, the IDE extension and Codex in the ChatGPT desktop app share ~/.codex/config.toml, so Botmail only needs to be set up once.

### Can Codex ask before it sends an email?

Yes. Set default_tools_approval_mode = "writes" on the botmail server and Codex asks before tools that aren't read-only, such as send_email, reply and forward.

### Can Codex use an API key instead of OAuth for Botmail?

Yes. Set bearer_token_env_var = "BOTMAIL_KEY" on the server and Codex sends the key from that environment variable as a Bearer token.

---

Source: https://botmail.pro/guides/codex-email
Agent instructions: https://botmail.pro/skill.md
All guides: https://botmail.pro/llms.txt
