Mailgun Setup
Step-by-step guide to setting up Mailgun with OneSignal for sending email messages. Includes DNS verification, SMTP credential setup, API key generation, and OneSignal integration instructions.
This setup guide is if you have Mailgun already and want to integrate it with OneSignal. If you don’t have a Mailgun account, you can use OneSignal Email instead.
Requirements
- Mailgun Account
- Mailgun US API (EU region is not supported)
- OneSignal Account
- A domain you own and access to its DNS provider
Setup
1. Add a new domain in Mailgun
Skip this step if your domain is already set up in the US region.
- Go to the Domains page in the Mailgun dashboard.
Navigate to the Domains page
- Click Add new domain.
Open Add New Domain form
- Enter a subdomain (e.g.,
mail.yourdomain.com
) and ensure the region is US.
Specify subdomain and select US region
2. Verify DNS settings
Mailgun provides the following DNS records:
- 2 TXT (SPF & DKIM)
- 2 MX
- 1 CNAME
Update these in your DNS provider. Propagation may take up to 48 hours. Mailgun will notify you via email once verified.
To verify:
- Go to Mailgun > Sending > Domain Settings > Your Domain > DNS Records
- Look for green checkmarks next to each record
Verify DNS setup
If CNAME is not set correctly, email click, open, and unsubscribe tracking will not work.
3. Set up SMTP credentials
- Go to Sending > Domain Settings > SMTP credentials in Mailgun.
Navigate to SMTP Credentials
- Click Add new SMTP user.
Add new SMTP credentials
- Set a login name and save the credentials.
Create SMTP user
- Click the copy icon to save the password securely.
Copy SMTP password
4. Get a Mailgun API key
- In the Mailgun dashboard, scroll to the bottom and click API Keys.
Navigate to API Keys
- Click Add new key
Add new key
- Name the key and click Create Key.
Create key
- Copy the generated API key and save it securely.
Copy API key
5. Configure Mailgun in OneSignal
- In OneSignal, go to Settings > Platforms > Email and choose Mailgun.
App setup email
- Select Mailgun as the provider.
App setup email
- Enter:
Configure provider
- Set default sender name and
from
email address.
Configure additional settings
6. Add OneSignal webhooks to Mailgun
Navigate to Mailgun > Sending > Webhooks > Your Domain > Webhooks and add:
Add webhook
7. Change tracking protocol to HTTPS
Ensure recipients are directed to secure URLs.
- Go to your domain settings in Mailgun.
- Under Tracking > Tracking Protocol, change from HTTP to HTTPS.
Change tracking protocol
8. Send a test email
- Go to OneSignal > Messages > Email, click New Email.
- Add a subject, click Send Test Email, input your email, and hit Send Test Message.
Send test email
You should receive the test email shortly.
Need help? See our Email FAQ or contact support@onesignal.com
.
For faster support, provide:
- Your OneSignal App ID
- Details, logs, and/or screenshots
- Steps to reproduce the issue
Email setup complete! Next steps:
- Return to the Email Setup guide to explore OneSignal Email capabilities.