Email for Codex
Fluxmail gives Codex CLI and the Codex app access to your Gmail, Outlook, Exchange, or IMAP mailboxes through MCP. Codex can search, read, draft, and send email, limited to the mailboxes and actions you allow.
What you can do
Turn email into tasks
Ask Codex to read a bug report or customer thread and open the relevant files, so the context comes straight from the message.
Find the right thread
Ask for the thread about a deploy, an invoice, or a contract. Codex builds the search with sender, date, and folder filters, so you do not need the exact subject line.
Draft status updates
Have Codex draft a reply that summarizes what changed in the code, then review it in your mail client before it goes out.
Connect Codex to your email
1. Install Fluxmail and connect a mailbox
Install the CLI, create the first administrator, and connect Gmail with the local OAuth flow. Outlook needs a Microsoft app registration; IMAP needs provider credentials. The quickstart covers Docker and provider setup.
npm install -g fluxmail fluxmail setup --name "Your name" --email you@example.com fluxmail accounts add gmail2. Add Fluxmail to Codex
For Codex CLI on the same computer as Fluxmail, add the stdio server:
codex mcp add fluxmail -- fluxmail stdio --profile read-onlyOr connect over HTTP
To connect over Streamable HTTP, create an API key with
fluxmail apikey create --name codex --profile read-only. Start the server withfluxmail serveunless Docker is already running it, then add it to~/.codex/config.toml:[mcp_servers.fluxmail] url = "http://localhost:8977/mcp" http_headers = { Authorization = "Bearer fmk_..." }
In the ChatGPT or Codex app, open Settings > Plugins > MCPs > Add server. Choose STDIO with the command fluxmail and the arguments stdio --profile read-only, or choose Streamable HTTP with the URL and an Authorization header.
Restart the app after saving, then ask Codex for the five latest emails in your inbox to test the connection.
See Permissions for every profile and capability, and the Codex MCP docs for client settings.
Bring a customer thread into a coding task
The setup above uses read-only access. Try this prompt with a mailbox you connected:
Find an email thread about [replace with a subject you know exists]. Read it and list the reported problem, expected behavior, and unanswered questions. Include the sender and subject so I can verify the source. Do not change my mail.
Check the result
The summary should match the thread in Gmail or Outlook. Check that Codex distinguishes what the sender reported from its own suggested fix. Searching an unfamiliar subject may correctly return no results.
To create drafts, change the stdio profile or HTTP key to read-write and reconnect. That profile also allows organizing and trashing mail, but cannot send or permanently delete messages. Review a draft in your mail client before sending it yourself.
If the connection does not work
- Run
codex mcp listin the CLI, or check the server in the app MCP settings. Start a new session after changing the configuration. - If the server connects but no mailbox appears, run
fluxmail accounts listas the same operating-system user. Check the instance, member, and mailbox scope used by the client. - For a command-not-found error, use the absolute path to the installed Fluxmail executable. For HTTP 401, check the API key and Authorization header. For a permission error, check the key or stdio profile before retrying.
Common questions
- Does this work with both Codex CLI and the Codex app?
- Yes. Codex CLI reads MCP servers from
~/.codex/config.tomlorcodex mcp add. The Codex app has its own MCP settings. Both can use stdio or Streamable HTTP. - Can I keep Codex read-only?
- Yes. The examples on this page use
--profile read-onlyfor both stdio and HTTP API keys. Codex can then search and read but cannot draft, send, or change mail. - Which email providers can Codex reach?
- Any mailbox connected to Fluxmail: Gmail and Google Workspace, Outlook and Exchange through Microsoft Graph, and other providers through IMAP and SMTP.
Reviewed
Build on top of email
Run Fluxmail on your own infrastructure and use it through MCP, REST API, or CLI.