Email from your terminal
npm install -g @mailsai/cliTwo kinds of output
Tables for you.
JSON for agents.
People get tables and short sentences. Pipe any command, or hand it to an agent, and stdout is clean JSON.
$ mails webhooks delete whe_01K…
Delete webhook whe_01K…? [y/N] y
✓ Deleted whe_01K….
$ mails webhooks delete whe_01K… \ --yes | jq -r .deleted_at
2026-10-07T10:42:07.000Z
The whole API,
one command away
Anything you can do with the mails.ai API, you can do from the CLI.
Every area of the API
Emails, receiving, agents, threads, drafts, events, webhooks, domains, API keys and more.
Sign in with your browser
mails login signs you in through your browser. No browser? Add --api-key and it asks for a key.
Bodies from disk
--text-file, --html-file and --body-file read a body from disk. --data - reads JSON from stdin.
Webhooks on your machine
mails webhooks listen posts signed events to your local handler. No tunnel, no public address.
Try the receiving side
mails receiving listen prints replies as they land. mails receiving simulate makes one up.
Add the MCP server
mails mcp install connects Claude, Claude Code, Cursor, Codex or VS Code to the hosted server.
Several workspaces
Save a profile per workspace and mails auth switch between them. Keys prefer your OS keychain.
Safe to retry
Sends carry an idempotency key, reads retry with backoff, and destructive commands ask first.
Diagnostics built in
mails doctor checks Node, your sign-in, the connection, your clock and your key’s scopes.
I test every agent with mails receiving listen. Replies print as they arrive.
For automation
Runs in your CI pipeline
Set MAILS_API_KEY as an environment variable and the CLI runs unattended, printing JSON.
# GitHub Actions
env:
MAILS_API_KEY:
${{ secrets.MAILS_API_KEY }}
steps:
- run: |
npx @mailsai/cli emails send \
--from hello \
--to team@example.com \
--subject "Deploy complete" \
--text "Shipped $GITHUB_SHA" \
--idempotency-key \
"deploy-$GITHUB_SHA"“Replies come back as events with an injection score already on them. We deleted a whole layer of parsing code the week we switched, and we gate on the quarantine flag, so our agent never sees the ones that look like attacks.”
“Moving our agent onto our own domain was a few DNS records at the registrar. No nameserver move, and our existing mail kept working. Replies to the agent still come back to its inbox, threaded with the message they answer.”
“The 422 on cold outreach is the feature I didn’t know I wanted. An agent can’t talk itself into emailing strangers.”
“Our tests send to the test address and wait for the real reply, so the whole loop is covered before a customer ever writes in. It answers in about a second, which keeps the suite fast.”
“Adding the MCP server was one JSON block. Claude Code could send and read its own inbox a minute later.”
“A reputation score per agent tells us exactly which one needs attention, instead of one number for the whole account. It comes from each agent’s own replies, bounces and complaints, and we read it from the API.”
“Sends and replies have separate allowances, so a busy inbox never eats our sending quota. Pricing was the easy part.”
“Half our agents are LangGraph in Python and half are Node. Both SDKs make the same calls, so the team doesn’t have to think about it.”
“Signed webhooks, retries with backoff and an event id to dedupe on. The boring plumbing, done properly.”
“We signed up, made a key and sent our first message without talking to anyone, and the free tier never asked for a card. That’s how infrastructure should feel.”
Give your first agent an inbox
Free covers 3,000 emails and 3,000 inbound replies a month, with no card. Upgrade when your agents get busy.
Get your API key