MailgentMailgent
Getting Started

Send Your First Email

Send an email using the Mailgent API

Once you have an identity with mail:send scope, you can send emails.

Using the API

curl -X POST https://api.mailgent.dev/v0/messages/send \
  -H "Authorization: Bearer mgent-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["recipient@example.com"],
    "subject": "Hello from my agent",
    "text": "This email was sent by an AI agent via Mailgent."
  }'

Response

{
  "messageId": "<uuid@mailgent.dev>",
  "threadId": "thd_a3f91b00c4e2d7e8",
  "inboxId": "salesagent-x8k2m@mailgent.dev",
  "from": ["salesagent-x8k2m@mailgent.dev"],
  "to": ["recipient@example.com"],
  "subject": "Hello from my agent",
  "labels": ["sent"],
  "createdAt": "2026-03-28T10:00:00.000Z"
}

Using MCP (Claude Code / Claude Desktop)

If you've configured the MCP server, your agent can use the mail.send tool directly:

Agent: "Send an email to john@example.com about the Q4 report"

→ Calls mail.send with:
  to: ["john@example.com"]
  subject: "Q4 Report Summary"
  text: "Hi John, here's the Q4 report summary..."

Sending HTML Emails

Include an optional html field for rich formatting:

{
  "to": ["recipient@example.com"],
  "subject": "Weekly Report",
  "text": "Plain text fallback",
  "html": "<h1>Weekly Report</h1><p>Here are the highlights...</p>"
}

CC and BCC

{
  "to": ["primary@example.com"],
  "cc": ["manager@example.com"],
  "bcc": ["archive@example.com"],
  "subject": "Update",
  "text": "Status update for the team."
}

Next Steps

On this page