# Mailgun {#mailgun}


Use your Mailgun account as the sending provider for Nitrosend campaigns, flows, and transactional email. See [Email providers](https://docs.nitrosend.com/integrations/email-providers.md) for how BYO sending works, plan requirements, and status semantics.


## What you need {#what-you-need}


- Your Mailgun **API key** (private API key from the Mailgun dashboard).
- Your Mailgun **sending domain** (the domain you send from in Mailgun, e.g. `mail.yourdomain.com`).

Nitrosend connects to Mailgun's US API endpoint and validates the key by listing your Mailgun domains when it tests the connection.



> [!WARNING]
> EU-hosted Mailgun accounts are not currently supported — connections use Mailgun's US endpoint.




## Connect from the dashboard {#connect-from-the-dashboard}


1. Go to **Integrations** in Nitrosend.
2. Choose **Mailgun**.
3. Enter the API key and sending domain, then save. Nitrosend tests the connection as part of saving a new integration.


## Connect via MCP {#connect-via-mcp}




> [!IMPORTANT]
> In the MCP tool, the `region` argument carries the Mailgun **sending domain** — not a geographic region.



```json
{
  "operation": "configure",
  "provider": "mailgun",
  "api_key": "<MAILGUN_API_KEY>",
  "region": "mail.yourdomain.com"
}
```



> [!WARNING]
> The MCP call stores the credentials without testing them. `{"operation": "status"}` reports stored configuration only — to actually test the credentials, run **Test connection** from the Mailgun integration page in the dashboard, or call `POST /v1/my/integrations/{id}/test` via the REST API.




## Making it the active provider {#making-it-the-active-provider}


If this is your first BYO provider, it becomes the brand's active email provider automatically. If you already had another provider connected, open the integration's page and choose **Set as primary** to switch sending to it.


## Sending domains {#sending-domains}


After connecting, add your sending domain from **Domains** (or `nitro_manage_domains`). The DNS records returned come from Mailgun's domain verification.


## Troubleshooting {#troubleshooting}


- **Connection test fails** — confirm you're using the private API key, that the key's account can list domains, and that your Mailgun account is US-hosted.
- **Rotated your key?** Re-entering credentials resets this integration's verified domains to pending — re-verify them from **Domains**.
