---
name: mailertogo
description: Send transactional email with Mailer To Go and keep it delivering. Use when an app or agent must send email through Mailer To Go (HTTP API or SMTP), when setting up or checking a sending domain's DNS records, or when troubleshooting a message that was refused, held, bounced or suppressed.
---

# Mailer To Go

Mailer To Go sends transactional email over a Mailgun-compatible HTTP API or over SMTP.
Production base URL: `https://api.mailertogo.com`. Staging: `https://api.mailertogrow.com`.
API reference: https://api.mailertogo.com/api-docs

**The model: Return-Path is ours. From is yours. Reply-To is yours.** You register the domain you
send as. Mailer To Go derives a relay host, `mtg.<your domain>`, for bounces. You never send
From the relay host.

## Guardrails

- Read the credential from the environment: `MAILERTOGO_SMTP_PASSWORD` (and `MAILERTOGO_SMTP_USER`,
  `MAILERTOGO_SMTP_HOST`, `MAILERTOGO_SMTP_PORT` for SMTP). Never ask the user to paste it into
  the conversation. Never write it into a file, a commit, a log or a command you echo.
- There is no separate API key. The SMTP password is the API credential. There is no
  `MAILERTOGO_API_KEY`.
- Before you send to a recipient the user has not named in this task, show the recipients,
  From and subject, and ask for confirmation. Send tests to an address the user owns.
- Do not change DNS unless the user asks. Read records with `dig` and the diagnostics endpoint.
- Never replace an existing DMARC record. Never put the relay host (`mtg.`) in a From address.
- If the Mailer To Go MCP server is configured, prefer its tools to hand-built HTTP calls.

## Set up a sending domain

1. Register the domain in the From address (usually the root domain, `yourdomain.com`):
   dashboard **Add Domain**, or
   ```bash
   curl -s -H "Authorization: Bearer $MAILERTOGO_SMTP_PASSWORD" -H "Content-Type: application/json" \
     https://api.mailertogo.com/api/v1/domains -d '{"hostname":"yourdomain.com"}'
   ```
   Optional `"relay_label"` if `mtg.yourdomain.com` is already in use.
2. Publish the two CNAME records the 201 response (`dns_records`) or the dashboard gives you.
   Copy the names and values from there; do not type them from memory. They look like:

   | Name | Type | Value | Job |
   |---|---|---|---|
   | `tap._domainkey.yourdomain.com` | CNAME | `tap._domainkey.yourdomain.com.dkim.mailertogo.net` | DKIM. Gates sending. |
   | `mtg.yourdomain.com` | CNAME | `rp.us-west-1.mailertogo.net` | Relay host for bounces. Does not gate sending. |

3. DMARC at `_dmarc.yourdomain.com` is recommended, not required. If there is none, suggest
   `v=DMARC1; p=none`. If one exists, keep it.
4. Verify: `dig CNAME tap._domainkey.yourdomain.com +short`, then
   `GET /api/v1/domains/yourdomain.com/diagnostics` and read `verdict.can_send`.
   Mail from an unverified domain is held, not refused.

Nothing touches the root MX, the root SPF or the mailbox provider. DNS details and pitfalls
(Cloudflare proxy, CNAME conflicts, subdomains): [references/dns.md](references/dns.md).

## The From rule

- From must be at the registered domain or a subdomain of it: `hello@yourdomain.com`,
  `noreply@notifications.yourdomain.com`.
- Another brand's domain: register that domain too.
- Reply-To can be any address. Set it with `h:Reply-To`.

## Send over the HTTP API

`POST /v3/{domain}/messages`, where `{domain}` is the registered domain. The body is
form-encoded (not JSON). Auth is the SMTP password, as Basic `api:<password>` or Bearer.

```bash
curl -s --user "api:$MAILERTOGO_SMTP_PASSWORD" \
  https://api.mailertogo.com/v3/yourdomain.com/messages \
  --data-urlencode from="YourApp <hello@yourdomain.com>" \
  --data-urlencode to="user@example.com" \
  --data-urlencode subject="Hello" \
  --data-urlencode text="It works."
```

```python
import os, requests

r = requests.post(
    "https://api.mailertogo.com/v3/yourdomain.com/messages",
    auth=("api", os.environ["MAILERTOGO_SMTP_PASSWORD"]),
    data={"from": "YourApp <hello@yourdomain.com>", "to": "user@example.com",
          "subject": "Hello", "text": "It works."},
    timeout=30,
)
r.raise_for_status()
print(r.json()["id"])  # the Message-ID; keep it for troubleshooting
```

Use `data=`, not `json=` or `files=`. A 200 is `{"id": "<...>", "message": "Queued. Thank you."}`.
Fields, limits and errors: [references/api.md](references/api.md).

**Not supported yet (refused with a 400 that names the field):** attachments, templates,
`o:*` options, `v:*` variables, recipient-variables.

## Send over SMTP

Use `MAILERTOGO_SMTP_HOST`, `MAILERTOGO_SMTP_PORT`, `MAILERTOGO_SMTP_USER` and
`MAILERTOGO_SMTP_PASSWORD` (Heroku add-on config vars, or the dashboard), with STARTTLS.
`GET /api/v1/smtp` returns the host, port and username for the account. The same From rule
applies. Prefer the HTTP API where outbound SMTP ports are blocked, in serverless code, and in
agent tools.

## Troubleshoot

1. **Read the error `message`.** It names the field and the fix. Do not retry an unchanged 400.
2. **Domain:** `GET /api/v1/domains/{domain}/diagnostics` re-resolves DNS now. Read
   `verdict.can_send`, then the `detail` of each check that is not `pass`.
3. **One message:** `GET /api/v1/activity?message_id=<id from the send response>`.
   `accepted` means we took it; `delivered` means the receiving server took it.
   A `failed` event with `severity: temporary` is a deferral that is still retried.
4. **Suppressions:** `GET /api/v1/domains/{domain}/suppressions`. A suppressed recipient is
   skipped at send time. Only clear one when the user confirms the address is good.

All `/api/v1` calls use `Authorization: Bearer $MAILERTOGO_SMTP_PASSWORD`. Details:
[references/api.md](references/api.md).

## MCP server

Mailer To Go has a remote MCP server at `https://api.mailertogo.com/mcp`
(Streamable HTTP; auth is the SMTP password as a Bearer token). Claude Code:

```bash
claude mcp add --transport http mailertogo https://api.mailertogo.com/mcp \
  --header "Authorization: Bearer $MAILERTOGO_SMTP_PASSWORD"
```

Other clients: add a remote (HTTP) MCP server with that URL and that `Authorization` header.
When its tools are available, use them for domain setup, sending and troubleshooting. The
rules above still apply.
