Everything you need to integrate MailAnvil — send transactional emails, manage domains, create templates, and hook in your AI agent via MCP.
Send your first email with MailAnvil in under 5 minutes. You'll need a domain you control and access to its DNS settings.
Go to mailanvil.com and create an account. You'll start on the Free plan — 500 emails/month, no credit card required.
Navigate to Domains in your dashboard and add a domain
you own (e.g. yourdomain.com). MailAnvil will give you
3 DKIM CNAME records to add to your DNS provider.
Once added, click Verify. Domain verification is required
before you can send — MailAnvil never sends from unverified domains.
Using Cloudflare for DNS? We can auto-create your DKIM, SPF, and DMARC records — no manual DNS wrangling needed.
See the Domain Verification section below for the full list of DNS records you'll need.
In your dashboard, go to API Keys and generate a new key. Save it somewhere secure — you won't be able to see it again. MailAnvil stores only a SHA-256 hash of your key.
Use curl to send a test email:
If everything is set up correctly, you'll receive a 202 Accepted response with an email ID you can use to track delivery.
Kirim email pertama Anda dengan MailAnvil dalam waktu kurang dari 5 menit. Anda memerlukan domain yang Anda kuasai dan akses ke pengaturan DNS-nya.
Kunjungi mailanvil.com dan buat akun. Anda akan memulai dengan paket Free — 500 email/bulan, tanpa perlu kartu kredit.
Buka menu Domains di dashboard dan tambahkan domain
yang Anda miliki (contoh: domainanda.com). MailAnvil akan
memberikan 3 catatan CNAME DKIM untuk ditambahkan ke
penyedia DNS Anda. Setelah ditambahkan, klik Verify.
Verifikasi domain wajib dilakukan sebelum Anda dapat mengirim — MailAnvil
tidak pernah mengirim dari domain yang belum diverifikasi.
Menggunakan Cloudflare untuk DNS? Kami dapat membuat catatan DKIM, SPF, dan DMARC secara otomatis — tidak perlu repot mengatur DNS manual.
Lihat bagian Domain Verification di bawah untuk daftar lengkap catatan DNS yang diperlukan.
Di dashboard, buka API Keys dan buat kunci baru. Simpan di tempat yang aman — Anda tidak akan bisa melihatnya lagi. MailAnvil hanya menyimpan hash SHA-256 dari kunci Anda.
Gunakan curl untuk mengirim email uji coba:
Jika semuanya sudah diatur dengan benar, Anda akan menerima respons 202 Accepted dengan ID email yang dapat digunakan untuk melacak pengiriman.
Base URL: https://api.mailanvil.com. All requests require
authentication via Bearer token in the Authorization header.
Responses are JSON.
Idempotency: Send a unique Idempotency-Key
header with POST requests to prevent duplicate sends on retry.
| Method | Path | Description |
|---|---|---|
| POST | /v1/send | Send an email. Returns 202 with { "id", "state" }. |
| GET | /v1/emails/:id | Get email status and delivery details. |
| POST | /v1/domains | Register a new sending domain. |
| GET | /v1/domains | List all domains for your account. |
| GET | /v1/domains/:id | Get a single domain's verification status and DNS records. |
| POST | /v1/domains/:id/verify | Trigger DNS verification check for a domain. |
| POST | /v1/templates | Create an email template. |
| GET | /v1/templates | List templates. |
| GET | /v1/templates/:id | Get template by ID. |
| PUT | /v1/templates/:id | Update a template. |
| DELETE | /v1/templates/:id | Delete a template. |
| POST | /v1/webhooks | Create a webhook endpoint. |
| GET | /v1/webhooks | List webhooks. |
| GET | /v1/webhooks/:id | Get webhook by ID. |
| PUT | /v1/webhooks/:id | Update a webhook. |
| DELETE | /v1/webhooks/:id | Delete a webhook. |
| GET | /v1/account | Get account details and usage stats. |
All errors follow a consistent JSON structure:
Error codes returned by the API:
| Code | HTTP Status | Description |
|---|---|---|
| invalid_api_key | 401 | The API key is missing, malformed, or invalid. |
| domain_not_verified | 403 | The sender domain hasn't been verified via DNS. |
| sending_paused | 403 | Sending is paused for your account (check dashboard). |
| recipient_suppressed | 403 | The recipient is on the global suppression list. |
| rate_limited | 429 | Too many requests. Retry after the indicated delay. |
| validation_error | 422 | Request body failed schema validation. |
| not_found | 404 | The requested resource doesn't exist. |
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer re_... — your API key |
| Content-Type | Yes | application/json |
| Idempotency-Key | Recommended | Unique string — prevents duplicate sends on network retry |
MailAnvil ships a full Model Context Protocol (MCP) server with Streamable HTTP transport. Your AI agent discovers the tools automatically — no SDK install needed.
Add the following entry to your mcp.json (Claude Code, Cursor,
or any MCP-compatible client):
That's it. Restart your MCP client and the tools will be available immediately.
| Tool | Description | Arguments |
|---|---|---|
| send_email | Send a transactional email | from, to[], subject, html/text |
| get_email_logs | Retrieve recent email logs and delivery status | limit, offset |
| list_domains | List all verified and pending domains | none |
| list_templates | List email templates | none |
| get_usage_stats | Get current billing period usage | none |
Once MCP is configured, just ask Claude Code in natural language:
"Send a booking confirmation email to budi@example.com for his Dieng Volcano trip tomorrow morning."
Claude Code calls send_email with the right parameters
automatically, using your verified domain and MailAnvil's API:
Before you can send email through MailAnvil, you must verify ownership of your sending domain by adding specific DNS records. This protects your sender reputation and ensures deliverability.
MailAnvil never sends from unverified domains. If you
attempt to send from an unverified domain, the API returns a
domain_not_verified error.
After adding your domain in the MailAnvil dashboard, you'll receive the following DNS records to configure. The exact values (especially DKIM tokens) are generated per-domain and shown in your dashboard.
~all
soft-fail is recommended — hard-fail (-all) may cause legitimate
email to bounce.
p=none to monitor, then move to p=quarantine
once deliverability is proven.
In the MailAnvil dashboard, navigate to Domains and click Add Domain. Enter your domain name (e.g. yourdomain.com).
MailAnvil generates the 3 DKIM CNAME records specific to your domain. Copy each one along with the SPF and DMARC records shown above.
Log into your DNS provider (Cloudflare, Namecheap, AWS Route53, etc.) and add each record. CNAME records go in the DNS zone for your domain. Some providers require the hostname without the domain suffix — check their docs.
DNS changes can take a few minutes to several hours to propagate. Most providers update within 5–10 minutes.
Back in the MailAnvil dashboard, click Verify. MailAnvil checks that all records resolve correctly. If everything checks out, your domain status changes to Verified and you can start sending immediately.
Using Cloudflare? MailAnvil can auto-create all required DNS records via the Cloudflare API. Just connect your Cloudflare account and we'll handle the rest.