← Back to all posts

How AI Coding Agents Send Emails: MailAnvil MCP Server Tutorial

2026-09-13 · MailAnvil Team

How AI Coding Agents Send Emails: MailAnvil MCP Server Tutorial

You're building an app in Cursor. You need a password reset email. The old way: leave the IDE, open MailAnvil docs, copy an API key, write fetch() with headers, handle errors, test. Ten minutes for one email.

The new way: type "send a password reset email to [email protected]" and the agent does it. MCP makes this possible.

MailAnvil is the first email API with a native MCP server. Your AI coding assistant connects to it directly — no API wrappers, no SDK, no boilerplate.

What is MCP?

Model Context Protocol is a standard for AI agents to discover and use external services. Instead of hardcoding API integrations, the agent reads a tool schema that describes what's available — endpoints, parameters, authentication.

When you add MailAnvil's MCP server to your editor, the agent knows: - How to send emails (with to, subject, html params) - How to list domains - How to check email status - How to manage templates

No hallucinated API calls. No guessing the request shape.

Setup: 3 minutes

Step 1 — Get your API key

Sign up at mailanvil.com. You get 500 free emails/month — no credit card.

Copy your API key from the dashboard.

Step 2 — Add the MCP server

Cursor / Windsurf:

Add to your MCP config (.cursor/mcp.json or equivalent):

{
  "mcpServers": {
    "mailanvil": {
      "url": "https://mcp.mailanvil.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Claude Code:

claude mcp add mailanvil --transport sse https://mcp.mailanvil.com/mcp
# Set the API key as an environment variable
export MAILANVIL_API_KEY=your_key_here

Step 3 — Use it

In your editor, the agent now has MailAnvil tools available. Ask it to send an email:

"Send a welcome email to [email protected] from [email protected] with subject 'Welcome to MyApp' and a nice HTML body"

The agent calls the MCP tool directly. No curl, no fetch, no API docs lookup.

Real use cases from Indonesian SaaS

Travel booking confirmations

Traveloka-style apps send booking confirmations immediately after payment. The agent can draft and send a confirmation email with booking details, e-tickets, and payment summary — all from a single prompt.

Food delivery invoices

GoFood, GrabFood — every order needs a receipt email. MCP lets your agent integrate email sending into your order processing flow without leaving the codebase.

Fintech OTP verification

Dana, OVO, LinkAja — OTP emails must arrive in under 5 seconds. MailAnvil runs on Cloudflare's Jakarta edge. MCP means your agent can implement and test the OTP flow without context-switching.

Why this matters for Indonesian developers

No USD billing shock

MailAnvil charges in Rupiah. Starter plan: Rp 149rb/month for 10,000 emails. That's ~$10. SendGrid charges ~$35 for the same volume. The pricing difference compounds fast when you're paying monthly in IDR.

QRIS and GoPay payments

No international credit card required. Pay for your email API with the same QRIS code your users scan at warung.

Bahasa documentation

MCP tool descriptions, docs, and support — all in Bahasa Indonesia. No more translating error messages mid-debug.

Comparison: MCP vs traditional email API integration

Aspect Traditional MailAnvil MCP
Time to first email 15-30 minutes 3 minutes
Code required ~40 lines 0 lines
API docs lookup Every endpoint Agent knows schemas
Error handling Manual try/catch Agent handles retries
Context switching IDE → docs → code → test Stay in IDE

Security note

Your API key stays in the MCP config — never sent to the AI provider. The MCP server authenticates directly with MailAnvil. The AI agent sees tool schemas, not your credentials.

For production: use a restricted API key with only the permissions your agent needs. MailAnvil supports granular API key scoping in the dashboard.

What's next?

The MCP server is built on the JSON-RPC standard used by Claude, Cursor, Windsurf, and other AI tools. As more editors adopt MCP, MailAnvil's email tools work everywhere — zero additional integration work.

Start free: mailanvil.com — 500 emails/month, no credit card, IDR pricing from day one.