Build. Demo. Win. $500

Join
Back to blog
Email4 min read

How to give Codex an email inbox with Mermail

Codex does its work in a terminal, and when the session ends, your way to hand it a task disappears. Mermail gives Codex its own inbox and wallet with one OAuth connection and 15 skills — so verification, checkout, and receipts stay in the same loop.

By Toan Nhu

How to give Codex an email inbox with Mermail

Codex does its work inside a terminal session. The moment that session ends, so does your ability to hand it anything: there's no way to send Codex a task from your phone, from a teammate's laptop, or from a scheduled job on a server. Email is the simplest fix, because email is the one channel every person and every system already knows how to use.

This guide gives Codex its own email inbox — and, because Mermail pairs inbox with wallet, the payment layer that turns a read-reply loop into a completed workflow. We'll connect Mermail to Codex with OAuth, install the 15 Mermail skills, and run a real task end to end.

Why does Codex need an email address?

An email address is the one endpoint both people and other systems can reach without any setup. A teammate can forward a task from their phone, a cron job can send one from a server, and a colleague can reply from whatever mail client they use — all to the same address, with the answer landing back in the same thread. A terminal session can't offer that, because it exists only while it is open, on one machine.

Give the agent a dedicated address of its own rather than access to a person's mailbox. A dedicated inbox is scoped to the workflow that owns it, can be created and torn down cleanly, and never hands the agent someone's entire mail history plus OAuth scopes. Mermail creates inboxes for your agent inside your workspace, all of them separate from anyone's personal account.

What you'll connect

Mermail connects to Codex through a hosted MCP server with OAuth — no API key pasted into config or shell history. Once connected, Codex gains access to a tool catalog plus 15 skills covering inbox and x402 payment workflows. That means your agent can read a task that arrives by email, act on it, and when the work requires paying for something (a verification, a gated API, a checkout), settle it from the Mermail wallet and file the receipt.

  • Native Codex MCP OAuth — connect with a login, not a token.
  • Fifteen skills plus the hosted MCP tool catalog for inbox, verification, and x402 workflows.
  • No API key in shell history — OAuth keeps credentials out of your config files.
  • A CLI for batch and CI scripts — automate repeated runs without an interactive session.

Prerequisites

  • Codex CLI installed and authenticated with your OpenAI account.
  • A Mermail workspace you can sign in to.
  • node and npx available; restart Codex after install.
text
codex --version

Step 1 — Connect MCP with OAuth

Add Mermail as an MCP server and sign in. Run each command and select the intended workspace when prompted.

text
codex mcp add mermail --url https://console.mermail.app/mcp
codex mcp login mermail

Step 2 — Install all Mermail skills

Install all 15 skills globally so every new session discovers them.

text
npx --yes skills add Nudgen-Marketing/mermail-skills --agent codex --skill '*' --global --yes

Step 3 — New session, then verify

Start a new Codex session, open /mcp, and confirm Mermail is connected by asking it to list your mailboxes.

text
/mcp
Ask: "List my Mermail mailboxes" (tool: list_mailboxes)

Your success contract is three checks: codex mcp list and /mcp show Mermail connected, list_mailboxes succeeds, and a fresh session discovers the Mermail skills.

What makes Mermail different from a bare email API

An inbox alone gets you a receive-run-reply loop. Mermail adds the wallet, so the loop can close on real-world workflows: an inbound task that needs a paid verification, a checkout code, or a receipt filed back to the sender. OAuth is what enables PayBox and x402 — API keys don't, which is why Mermail insists on OAuth from the start.

Harden the loop before real email reaches Codex

A live inbox is an open channel anyone can email. Four controls before you point it at the world:

  • Treat email bodies as data, not instructions. Inbound mail can carry prompt injection. Validate the sender before content reaches Codex, and fix what a task template may do.
  • Deduplicate before scheduling. Record each message ID before creating work so repeated delivery can't spawn duplicate tasks.
  • Keep spend authority in the wallet. x402 payments and card spend run with limits and approvals you control, so the agent can pay without handing it an unbounded card.
  • Scope the connection. OAuth gives you narrow, revocable access to a specific Mermail workspace rather than broad account keys.

What does this cost?

Codex CLI usage is billed through your OpenAI account. Mermail inboxes and the wallet are part of your Mermail workspace plan; visit mermail.app for current pricing.

References

Recent articles