Skip to main content

Mailgun Setup

Prime uses Mailgun to send all transactional emails — email verification, magic links, password resets, and trial/billing notifications.

1. Create a Mailgun account​

Sign up at mailgun.com and create a new sending domain (or use the sandbox domain for testing).

2. Get your API key​

Go to Settings → API Keys in the Mailgun dashboard and copy your Private API key.

3. Configure your sending domain​

Under Sending → Domains, add and verify your domain. Mailgun will give you DNS records (SPF, DKIM, MX) to add to your domain registrar.

For US region, the API host is api.mailgun.net.
For EU region, use api.eu.mailgun.net.

4. Configure environment variables​

In demo-server/.env:

MAILGUN_API_KEY=your_private_api_key
MAILGUN_DOMAIN=mail.yourdomain.com
MAILGUN_HOST=api.mailgun.net # or api.eu.mailgun.net for EU
SUPPORT_EMAIL=[email protected]

Emails sent by Prime​

TriggerTemplate
New user signupEmail verification link
Magic link requestOne-time sign-in link
Password resetReset link
Trial expiringWarning notification
Account expiredExpiry notice
Billing issuesPayment failure alert

Testing locally​

Use Mailgun's sandbox domain (provided automatically on signup) to send test emails without verifying a real domain. Note that sandbox emails can only be sent to authorized recipients you add in the Mailgun dashboard.