Connect Codex
How to connect Codex to email (send and reply via MCP)
Connect Codex to email with two commands: codex mcp add sendraven --url https://mcp.sendraven.ai/mcp, then codex mcp login sendraven to sign in.
Codex can then send from your own domain, read replies as threads and answer them, and with an API key in config.toml it runs under that key's daily cap, allowlist and approval hold.
codex mcp add sendraven --url https://mcp.sendraven.ai/mcp
codex mcp login sendraven> Run the test suite. If anything fails, email the failing test names and the first error to oncall@yourcompany.com.Before you start
What Codex needs.
The Codex CLI, signed in to OpenAI.
A SendRaven workspace with a verified sending domain and a payment method on it. Free includes 3,000 emails a month and is never charged without an upgrade.
For unattended runs, an API key in an environment variable.
Setup
Connect Codex step by step.
Add the server and sign in
The login opens a browser to sign in and pick a workspace. On a machine without one, add --no-browser and open the printed URL elsewhere.
Terminalcodex mcp add sendraven --url https://mcp.sendraven.ai/mcp codex mcp login sendravenOr use a key in config.toml
Codex reads the token from the variable you name, so the key never sits in the file.
~/.codex/config.toml[mcp_servers.sendraven] url = "https://mcp.sendraven.ai/mcp" bearer_token_env_var = "SENDRAVEN_API_KEY"Check it
codex mcp list shows the server; inside a session, /mcp lists its tools.
Terminalcodex mcp list
Try it
Three things to ask Codex.
“Run the test suite. If anything fails, email the failing test names and the first error to oncall@yourcompany.com.”
Runs the tests in the repository, then sends the result with send_email. On a key allowlisted to your own domain it cannot mail anyone else.
“Schedule the weekly metrics email to the team for Monday at 09:00 UTC.”
Sends with send_email and scheduled_at, and the message waits in list_scheduled_emails, where cancel_scheduled_email can still stop it.
“Give me one line on each email thread that is waiting on an answer.”
Calls list_threads with awaiting_reply and summarises each from get_thread. Out-of-office replies and bounces never appear in that list.
Once connected
What Codex can do with email.
Send
From your own verified domain, as plain text, HTML or a stored template, now or at a set time.
- send_email
- send_template_email
- list_scheduled_emails
Read the replies
Replies join the thread they answer on Message-ID, with the quoted history removed, and one call lists what is waiting on you.
- list_threads
- get_thread
- mark_thread_handled
Reply in the thread
The answer goes into the same conversation with the right headers, so it lands under the original in the recipient's inbox.
- reply_to_message
Run sequences and campaigns
Automations that stop when someone replies or unsubscribes, and campaigns that can be previewed before they go.
- create_automation
- enroll_in_automation
- preview_broadcast
Every tool the server has, grouped by what an agent is trying to do.
Safety controls
The limits live on the key, not in the prompt.
Codex reaches exactly what its credential can reach. Give an agent's API key any of these, and the tools respect them because the API underneath enforces them.
A daily send cap
daily_send_limit stops the key once it has sent that many today, counting scheduled and held mail too.
A recipient allowlist
allowed_recipients takes addresses and whole domains. Anything else is refused before it is written.
An approval hold
requires_approval turns every send into a draft that a person releases. The key cannot approve its own drafts.
A browser sign-in carries none of the three, so use a key for anything that runs unattended. A key also cannot raise its own limits: key management has no MCP tool. Every limit a key can carry.
Troubleshooting
If it does not work.
codex mcp login hangs on a server or over SSH.
Run it with --no-browser, open the printed URL on a machine with a browser, and finish the sign-in there. Or skip OAuth and use bearer_token_env_var with a key.
Tools fail with 401 after switching to a key.
bearer_token_env_var names a variable, not the key. Export SENDRAVEN_API_KEY in the shell that starts Codex, or the server receives no token.
The server times out while Codex starts.
Codex waits 10 seconds for a server by default. On a slow connection raise startup_timeout_sec under [mcp_servers.sendraven].
Why not just Resend?
Resend has an MCP server too. The difference is what happens after the send.
The reply is a thread, not a webhook
SendRaven: Joined on Message-ID to the message it answers. Resend: a received-email event; you fetch the message and set reply headers yourself.
Per-key daily cap and recipient allowlist
SendRaven: daily_send_limit and allowed_recipients on the key, checked on every send. Resend: keys scope to a domain and to send-only; no cap or allowlist.
Human approval hold on a key
SendRaven: requires_approval drafts the message and waits for a person. Resend: not offered.
From resend.com, last checked 16 September 2026. The full comparison, including where Resend is the better choice.
Questions
Can Codex send emails?
Yes, through an MCP server for an email service. With SendRaven added, Codex sends from your own verified domain, schedules sends and reads and answers reply threads.
How do I add a remote MCP server to Codex?
codex mcp add <name> --url <url> adds a Streamable HTTP server, here codex mcp add sendraven --url https://mcp.sendraven.ai/mcp, and codex mcp login <name> signs in. Both write to ~/.codex/config.toml.
Can I use an API key instead of signing in with Codex?
Yes. Set bearer_token_env_var under [mcp_servers.sendraven] in config.toml to the name of a variable holding the key, and Codex sends it as a Bearer token. The key's daily cap, allowlist and approval hold then apply.
Can Codex email me when a long task finishes?
Yes. Ask it to send the result when it is done; it calls send_email at the end of the task. An allowlist of your own address on its key keeps that the only place it can send.

Give Codex an inbox it cannot misuse.
Verify a domain, create a key with the limits you want, and connect. Free includes 3,000 emails a month, inbound included, and is never charged without an upgrade.

