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

Set up with Codex

Paste this prompt into Codex from the project where you want to use email. It installs Fluxmail, asks which mailboxes to connect and what Codex may do, configures the connection, and checks that it works. You enter passwords and approve provider access yourself.

Setup prompt
Set up Fluxmail Self-Hosted for this project. Read https://fluxmail.ai/docs/self-hosted/setup.txt and follow the setup guide. Ask me where I want to run it, which mailboxes to connect, and what the agent should be allowed to do. Configure my client and verify the connection without reading message bodies or changing mail. Guide me through password entry and provider consent.

Or set it up manually

  1. 1. Install Fluxmail and connect a mailbox

    Fluxmail Self-Hosted runs on your own computer or server. 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 gmail
  2. 2. 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-only
  3. Or connect over HTTP

    To connect over Streamable HTTP, create an API key with fluxmail apikey create --name codex --profile read-only. Start the server with fluxmail serve unless 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 Codex app, open Settings > Plugins, select Add, then Add MCP server. Choose STDIO, enter fluxmail as the command to launch, and add the arguments stdio --profile read-only. For an HTTP server with an API key, add the config.toml entry above instead.

Restart the app after saving, then ask Codex for the five latest emails in your inbox to test the connection.

See Permissions for what each permission allows, and the Codex MCP docs for client settings.

Bring a customer thread into a coding task

This prompt only reads mail. Try it 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.

Learn the supported email search filters

If the connection does not work

  • Run codex mcp list in the CLI, or check the MCPs tab under Settings > Plugins in the app. Start a new session after changing the configuration.
  • If the server connects but no mailbox appears, run fluxmail accounts list as 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.
Troubleshoot provider authentication and client access

Common questions

Does this work with both Codex CLI and the Codex app?
Yes. Codex CLI reads MCP servers from ~/.codex/config.toml or codex mcp add. The Codex app lists the same servers on the MCPs tab under Settings > Plugins. Both can use stdio or Streamable HTTP.
Can I keep Codex read-only?
Yes. The examples on this page use --profile read-only for 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

Connect your agent to your email

Run Fluxmail on your own infrastructure and use it through MCP, REST API, or CLI.