Let Claude send email safely
chainmail puts a policy daemon between an AI agent and your mail servers. The daemon checks every send against an allowlist that you set. A send to anyone else is saved to Drafts for you to review, and is never transmitted.
Why an agent's sends need a check
An agent that reads your mail also reads text that strangers wrote. A message can tell the agent to forward a contract or to write to someone new. chainmail returns that text marked as untrusted, and the MCP server tells the agent to treat it as data, never as instructions.
The allowlist does not depend on the agent following that instruction. The daemon holds a send to an address you did not list, whatever the agent was told. You then decide whether the message goes out.
How a send is checked
The daemon checks every send before anything is transmitted. That covers send, send-raw, reply, reply --all, forward and draft send at the shell, and send_email, reply, forward and send_draft over MCP. It looks at the To, Cc and Bcc recipients together. A send is held when any of these is true:
- A recipient is not on the allowlist.
- A recipient is not a plain
local@domainaddress, whatever the allowlist says. - The message has more recipients than
max_recipients, which is 10 by default.
A dry run and a saved draft transmit nothing, so the policy does not check them.
The allowlist
The policy is the [policy] table of the daemon's config, /etc/chainmail/config.toml. Each account can add its own send_allow list, which applies to that account only.
[policy]
send_allow = ["*@example.org", "[email protected]"]
max_recipients = 10
allow_expunge = false
allow_folder_delete = false
[accounts.personal.policy]
send_allow = ["[email protected]"]An entry is a bare address, which matches only that address, or *@domain, which matches any address at exactly that domain. Subdomains do not match, so *@example.org does not allow an address at mail.example.org. Matching ignores case.
Mail between your own configured accounts is never held. With no entries at all, every send to anyone else is held.
The daemon reads the config only at startup, so a change takes a restart. It refuses to start on an invalid entry or an unknown key.
What happens to a held send
A held send is never transmitted. The daemon saves the exact message it built to the account's Drafts folder. Bcc recipients are kept in a Bcc header, so nobody is lost when you send the draft from your mail client.
At the shell, the command prints held by policy, not sent: saved to Drafts with the draft's ref and the blocked recipients, and exits 4. Over MCP, a held send is a successful result with status held:
{
"status": "held",
"message_id": {"untrusted": "[email protected]"},
"draft_ref": "cm1:work:Drafts:1793457333:12",
"blocked": [{"untrusted": "[email protected]"}],
"too_many_recipients": false,
"hint": "held by policy: saved to Drafts for the user to review and send",
"idempotency_key": "mcp-kdmfryeyl3gh6ycbrkxqzrnllb7ufqsxbkeebfnj5dgkzuhwkroa"
}Its summary tells the agent that the message was not sent. It also says not to retry the send and not to look for another way to send it, such as another account or fewer recipients per send. A repeat with the same input replays the hold and saves no second draft.
What you do with a held draft
- Send it, edit it or delete it from your own mail client.
- Delete it with
chainmail draft delete. Whileallow_expungeis off, the draft moves to Trash. - To always allow the recipient, add it to
send_allow, restart the daemon, and send the draft withchainmail draft send.
This command lists the sends of the last day, with held ones marked held. Audit rows never hold recipient addresses.
chainmail audit --since 24h --action send --output tablePolicy and sends covers holds on a running host.
Calendar invitations get the same check
A new event sends invitations to its attendees, and an answer to an invite goes to its organizer. The daemon checks the people each calendar write would reach as the recipients of one send, with the same allowlist and max_recipients.
A held new event is created as a draft event that invites no one, and you send its invitations from your calendar app. A held change, cancellation or answer through the calendar is not applied. A held answer by email is saved to Drafts.
Deletes stay off until you allow them
allow_expunge and allow_folder_delete are false by default. With them off, the daemon refuses expunge and folder delete, and the MCP server does not list the expunge and delete_folder tools.
Trash, move, copy, archive and the flag and label commands are not gated. Mail in Trash can be recovered until the server empties it.
What the agent can and cannot reach
The daemon keeps every password and token in an age-encrypted vault, and no call returns one. Root owns the config that holds the policy, so neither your user nor the daemon can loosen the allowlist. The audit log is an append-only table that records every policy decision.
Any client allowed on the daemon's socket can still send as any configured account to anyone on the allowlist, and can move, archive, flag and trash mail. Give the socket only to users and agents you trust that far.
An agent that can run sudo without a password can get around the daemon, because root can read the vault key. Run agents from an account that cannot. The security model lists what chainmail protects and what it leaves to the operating system.
Connect Claude Code to your email sets chainmail up, and the features page lists the tools the policy covers.