Mailgun sandbox domain: "for test purposes only" and authorized recipients
Every Mailgun account comes with a sandbox domain (sandbox….mailgun.org) that can only send to authorized recipients: up to 5 addresses, each of which must click an activation link before mail reaches it. Sending to anyone else is rejected with a reason saying sandbox subdomains are for test purposes only. To send to real users, add and verify your own domain; Mailgun's help centre says that on the Free plan without card details you are limited to authorized recipients even then.
- Open the sandbox domain's settings In the Mailgun control panel go to Send › Sending › Domain settings and select the sandbox domain in the Domain drop-down.
- Add the address On the Setup tab enter the recipient's email address and click Add. You can have up to 5.
- Have the recipient activate it They must click the activation link Mailgun emails them; until then the address shows as Unverified and mail is still rejected.
- Send again Send from the sandbox domain to the verified address and check Send › Logs for an accepted and a delivered event.
What the rejection looks like
The send request is accepted by your code, but the message never goes out. In Send › Logs (or the Logs API) you find a rejected event instead of accepted → delivered. Mailgun's own example of that event carries this reason:
Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings.It means you sent from the sandbox domain to an address that is not on its authorized list, or that is on the list but hasn't clicked the activation link yet.
A related restriction catches people who have already added their own domain: Mailgun's help centre says accounts on the Free plan without card details are "restricted to sending just to Authorized Recipients", and that adding a card upgrades the account so custom domains can send to anyone.

What the sandbox domain allows
| Feature | Sandbox domain | Your own verified domain |
|---|---|---|
| Recipients | Only authorized recipients, up to 5 | Anyone (on an upgraded account) |
| Receiving (Routes) | Limited to one Route | Normal Routes |
| Tracking | Yes | Yes |
| Can be deleted | No | Yes |
The restriction also applies to Routes triggered by messages to the sandbox domain and to mailing lists created under it.
Add an authorized recipient
In the control panel: Send › Sending › Domain settings, pick the sandbox domain in the Domain drop-down (the long name starting with sandbox), open the Setup tab, enter the address and click Add. Mailgun emails that address an invitation; the recipient shows as Unverified until they click the activation link, then Verified. Only users with the Administrator or Developer role can add authorized recipients.
The same thing over the API (the address goes in the query string):
curl -s --user "api:$MAILGUN_API_KEY" -X POST \
"https://api.mailgun.net/v5/sandbox/[email protected]"
# list them, with "activated": true once the link was clicked
curl -s --user "api:$MAILGUN_API_KEY" \
https://api.mailgun.net/v5/sandbox/auth_recipientsA sixth address is refused with 400 and {"message": "Only 5 sandbox recipients are allowed"}. Free a slot with DELETE /v5/sandbox/auth_recipients/{email}.
Why it still fails after you added the address
- The recipient hasn't activated. The list entry exists but
activatedisfalse. Ask them to find the invitation (check spam) and click the link. - You are sending from your own domain on a Free account. Authorized recipients only exist within the sandbox domain, and the Free-plan restriction still applies to custom domains until the account is upgraded.
- The code still points at the sandbox. The domain in the URL (
/v3/sandbox….mailgun.org/messages) decides which domain sends, not thefromheader. Switch both to your domain. - A typo or alias.
[email protected]is a different address from[email protected]; each needs its own slot.
Moving from the sandbox to a real domain
For production you need your own domain. Mailgun recommends a subdomain such as mg.example.com, so your sending reputation is kept apart from your company mail. Add it under Send › Sending › Domains › Add new domain, choose its region (it can't be changed later; see US vs EU region), then publish the DNS records and verify them: Mailgun domain verification walks through each record. Once the domain is verified and the account upgraded, change the domain in your API URL and from address, and the authorized-recipient limit no longer applies.
Questions
How many authorized recipients can a Mailgun sandbox have?
Up to 5. Adding a sixth over the API returns 400 with the message "Only 5 sandbox recipients are allowed".
Can I delete the sandbox domain?
No. Mailgun's API reference states that the sandbox domain can't be deleted; just stop sending from it.
Who can add authorized recipients?
Account users with the Administrator or Developer role. Support users can resend messages to authorized recipients but can't add them.
Do authorized recipients work on my own domain?
No. They only exist within the sandbox domain. To send to anyone from your own domain, verify it and make sure the account is upgraded.
Related
- Mailgun domain not verified: DNS records to checkMailgun verifies a domain from SPF and DKIM TXT records; MX and the tracking CNAME serve receiving and tracking. Values, DNS mistakes and re-checking.
- Mailgun EU region API: US vs EU endpoints and errorsMailgun EU domains use api.eu.mailgun.net, US domains api.mailgun.net. The key works in both, so the wrong host says the domain doesn't exist.
- Mailgun failed events: permanent vs temporary failuresA Mailgun failed event has severity permanent (dropped, not retried) or temporary (retried for up to 8 hours). How to read reason and delivery-status.
- Bouncewise Mailgun API key: which key to useUse a Mailgun account API key (Admin or Support role), not a domain sending key. Bouncewise finds your US and EU domains with one key.
- Bouncewise: preview templates, send a test emailPreview your Postmark, Mailgun, SendGrid or Resend templates with sample data and send a test to yourself. Per-provider sender rules and common errors.