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
| Trigger | Template |
|---|---|
| New user signup | Email verification link |
| Magic link request | One-time sign-in link |
| Password reset | Reset link |
| Trial expiring | Warning notification |
| Account expired | Expiry notice |
| Billing issues | Payment 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.