Skip to content

Send from a client · Published 2026-09-22 · Updated 2026-09-28 · AgentiSend

Send email from Codex

To send email from Codex, paste the Codex install line on the MCP guide, give the key a budget, and ask Codex to send.

To send email from Codex, paste the Codex install line from the MCP guide, put the key in the AGENTISEND_API_KEY environment variable, give that key a budget, and ask Codex to send. The line is codex mcp add with --bearer-token-env-var, so the key itself is never written into a Codex config file. Codex has no config snippet of its own on this page.

The install line

It reads codex mcp add agentisend --url, then the server URL, then --bearer-token-env-var AGENTISEND_API_KEY. Copy it whole from the MCP guide, where it is generated from the same URL as every other client's line. Codex records the entry in ~/.codex/config.toml: TOML, in your home directory, holding the variable's name and not the token. Do not hand-write a second JSON file for Codex.

Where the key lives

In the environment Codex runs in. Export AGENTISEND_API_KEY in the shell that starts it, or set it wherever that environment is defined, and the config never needs to know the value. Two things follow from that:

  • Rotating is an environment change. POST /api-keys/{id}/rotate returns a new token and keeps the old one valid for a grace window; put the new token in the variable before the window closes, and config.toml stays as it was. Rotating without downtime has the steps.
  • A separate key per task needs no config change. A different value in the variable is a different key, with its own budget.

The shape underneath

For reference only, this is the generic remote form the connection resolves to: one URL and one Authorization header.

{
  "url": "https://api.agentisend.com/mcp",
  "headers": {
    "Authorization": "Bearer as_YOUR_API_KEY_HERE"
  }
}
Any other agent

Generic remote-MCP configuration: point any streamable-HTTP MCP client at this URL with this Authorization header.

Check the budget before a long job

A Codex task can run through many steps. get_agent_budget returns what the key may still send, when the period resets and the per-minute ceiling, so ask for it before the work starts rather than finding out halfway. Its REST twin is GET /limits/keys/{id}.

Use the agentisend MCP server. Call whoami, then get_agent_budget, and tell me how many sends remain and when the period resets. If the job I describe next needs more than that, say so and stop before starting. For now, send one test from any address to success@simulator.agentisend.com and give me the message id.

The permission to give it

sending_access, created with POST /api-keys, with a ceiling set by PATCH /limits/keys/{id}. Codex cannot raise that ceiling. A run that hits agent_budget_exceeded, approval_required or kill_switch_active should end there and report the fix, because retryable is false on all three.

The same limits from every client

Budgets, loop detection, approvals and the kill switch behave identically whichever client holds the key, so they are not repeated here. The guardrails checklist maps each item people are told to hand-write onto the request that already enforces it, and Email for AI agents names every control with its endpoint.

Next