Mailgun Setup Guide

Connect Mailgun to FormBlade for powerful email delivery with detailed analytics and routing rules.

Recommended for: Users on a paid Mailgun plan who need advanced features like email routing, log retention, and dedicated IPs. Also good for users who already have a verified domain with Mailgun.
Not recommended for: Users looking for a hassle-free free tier. Without a credit card, Mailgun restricts sending to only 5 whitelisted recipients — making it impractical for real form notifications. If you need a free provider, use Brevo instead.
⚠️ Critical free tier limitation: Without adding a credit card to your Mailgun account, you can only send to 5 whitelisted email addresses that you manually authorize. This means form submissions can only trigger notifications to those 5 addresses. Adding a credit card (even without upgrading) unlocks sending to anyone at 100 emails/day.

Free tier details

FeatureWithout credit cardWith credit card (no paid plan)
Daily sending limit100 emails/day100 emails/day
Recipients5 whitelisted onlyAnyone
Custom domainRequiredRequired
Log retention1 day1 day
Sandbox domainYes (5 recipients)Yes (5 recipients)

Step 1: Create a Mailgun account

  1. Go to signup.mailgun.com
  2. Sign up with your email address
  3. Confirm your email address via the verification link
  4. Optional but recommended: Add a credit card under Billing to remove the 5-recipient restriction

Step 2: Add and verify a custom domain

Mailgun gives you a sandbox domain for testing, but it only sends to authorized recipients. For production use, you need to verify a custom domain.

  1. In the Mailgun dashboard, go to Sending → Domains
  2. Click Add New Domain
  3. Enter a subdomain dedicated to sending (e.g., mail.yourdomain.com or mg.yourdomain.com). Using a subdomain is recommended so it does not interfere with your main domain's email
  4. Mailgun will display DNS records you need to add:

Required DNS records

TypePurposeExample name
TXTSPF recordmg.yourdomain.com
TXTDKIM recordsmtp._domainkey.mg.yourdomain.com
MXInbound routing (required even for sending-only)mg.yourdomain.com

The exact record values are shown in the Mailgun dashboard after you add your domain. Add all records at your DNS provider, then:

  1. Go back to Sending → Domains in Mailgun
  2. Click Verify DNS Settings on your domain
  3. Wait for the records to propagate (usually 5–30 minutes, can take up to 48 hours)
  4. All three records should show green checkmarks when verified
⚠️ Sandbox domain limitations: The sandbox domain (sandboxXXXXX.mailgun.org) that Mailgun provides by default can only send to email addresses you explicitly authorize. Go to Sending → Domains → your sandbox domain → Authorized Recipients to add addresses. This is fine for testing but not for production.

Step 3: Get your API key

  1. In the Mailgun dashboard, click your avatar in the top-right corner
  2. Go to API Security (or navigate to app.mailgun.com/settings/api_security)
  3. Your Private API Key is listed at the top (it starts with key-)
  4. Click the eye icon to reveal it, then copy it
Tip: Mailgun also offers domain-specific "Sending API Keys" under each domain's settings. These are scoped to a single domain and are more secure. Either the private API key or a domain sending key will work with FormBlade.

Step 4: Configure FormBlade

  1. Log in to your FormBlade dashboard
  2. Open the form you want to configure
  3. Go to the Settings tab
  4. Under Email Provider, select Mailgun
  5. Paste your API key into the API Key field
  6. Set your From Email to an address on your verified domain (e.g., forms@mg.yourdomain.com)
  7. Optionally set a From Name
  8. Click Save

Step 5: Send a test email

  1. Click Send Test Email in the Email Provider section
  2. Check your inbox for the test notification
  3. If it fails, verify that your domain is verified, your API key is correct, and the recipient is not restricted by the 5-address limit

Troubleshooting

"Forbidden" or "401 Unauthorized" error

"Domain not found" error

Emails only sending to some addresses

Emails going to spam

No delivery logs

Mailgun free tier summary

For most users who want a free email solution, Brevo is a simpler choice with fewer restrictions. Mailgun shines on paid plans where you get access to advanced routing, analytics, and higher volume.

Common gotchas

Quick reference: where to find things in Mailgun

What you needWhere to find it
Private API KeyClick your avatar (top-right) → API Security, or go to app.mailgun.com/settings/api_security
Domain Sending KeysSendingDomains → click your domain → Sending API Keys
Domain verificationSendingDomains → click your domain → DNS records
Authorized recipients (sandbox)SendingDomains → sandbox domain → Authorized Recipients
Billing / credit cardClick your avatar (top-right) → Billing
Sending logsSendingLogs
Official documentation: For the latest on Mailgun's API, domain verification, and account limits, visit the Mailgun Documentation and the Messages API reference.