← Back to guides

How to let Claude Code send emails for you

Connect AgentInbox to Claude Code in one command. Your agent gets its own email address and can send, receive, and thread emails — no API keys required.

01

Prerequisites

  • Claude Code installed and working. If you don't have it yet, run npm install -g @anthropic-ai/claude-code and follow the setup prompts.
  • Terminal access — you'll run one command to register the MCP server.
  • A browser — OAuth auto-approve opens a tab briefly on first connect.
02

Add the MCP server

Open your terminal and run this single command:

claude mcp add --transport http agentinbox https://mcp.agentinbox.sh/mcp

That's it. This registers AgentInbox as an MCP server in your Claude Code configuration. The server URL is stored locally and persists across sessions.

03

First use

The first time Claude Code connects to AgentInbox, it needs to authenticate via OAuth. Here's what happens:

  1. Claude Code calls the MCP server and gets a 401 response.
  2. Your browser opens for roughly ~1 second — the OAuth flow auto-approves instantly. You'll see a brief flash and the tab closes.
  3. Claude Code receives an access token and stores it locally.
  4. Your agent is assigned a unique email address like agent-b4a0@agent-mail.agentinbox.sh.

On every subsequent session, authentication is fully automatic — no browser opens, no prompts. The stored credentials are reused silently.

04

Send your first email

Just tell Claude Code what you want to send in plain English:

> Send an email to hello@example.com saying I'm testing AgentInbox

Claude Code will call the send_email tool behind the scenes, filling in the to, subject, and body fields automatically. You'll see a confirmation with the email ID and your agent's sender address.

05

Check your inbox

Your agent can receive emails too. Anyone who replies to your agent's address lands in the inbox:

> Check my inbox for new emails

This calls the get_emails tool. Claude Code will summarize the results — showing sender, subject, and a preview of each email.

06

Get your email address

Not sure what address was assigned? Just ask:

> What's my email address?

This calls get_inbox_address and returns your agent's email, display name, plan tier, and domain. Share this address with anyone who needs to email your agent.

07

Advanced: email threading

AgentInbox supports email threads using the inReplyTo parameter. When your agent replies to an email, pass the original messageId as inReplyTo — this sets the standard In-Reply-To and References headers so email clients group messages into a conversation.

> Reply to the last email from alice@example.com and say "Thanks, I'll look into that"

Claude Code is smart enough to fetch the inbox, find the relevant message, extract the messageId, and pass it as inReplyTo automatically. You can also filter by thread using threadId in the get_emails tool.

08

Advanced: HTML emails

Need rich formatting? The send_email tool accepts an optional htmlBody parameter alongside the plain-text body.

When htmlBody is provided, the email is sent as a multipart MIME message — email clients that support HTML will render the rich version, while others fall back to the plain-text body. Just ask Claude Code to send an HTML email and it will construct the markup for you.

09

Alternative: API key auth

If you prefer to skip the OAuth flow entirely, you can use an API key. Add this to your .mcp.json file:

{
  "mcpServers": {
    "agentinbox": {
      "url": "https://mcp.agentinbox.sh/mcp",
      "headers": {
        "Authorization": "Bearer sk-your-api-key"
      }
    }
  }
}

With a Bearer token, no browser window opens at all. The agent is identified by its API key and gets the same persistent email address every time.

10

Pricing

Free

$0

per month

  • 500 emails / month
  • Unique agent email address
  • Send, receive, and thread

Pro

$5

per month

  • 10,000 emails / month
  • Higher burst limits
  • Priority support