Hey! These docs are for version 7.0, which is no longer officially supported. Click here for the latest version, 9.0!

OneSignal's Email Messaging requires the use of a third-party email service provider to handle email delivery. All you have to do is set up the integration between the provider and OneSignal, and you'll be ready to send emails through OneSignal.

Mixpanel EU

Unfortunately the MailGun EU API will not work at this time. You will need to use the US API or another provider like Mandrill or Sendgrid.

# Step 1. Create Mailgun Account

If you do not already have a [Mailgun](🔗) account, create one now.

# Step 2. Configure your Domain for Email

Next, you will need to set up your domain so that it can send emails from Mailgun. Go to **[Sending > Domains](🔗)** and click 'Add New Domain'

Then, add your domain and follow the setup. Mailgun provides great documentation on getting setup.


You will be given two TXT (SPF and DKIM), two MX, and a CNAME record. You will need to update your DNS records for your domain host.

Once you have set up your DNS records, it make take up to 48 hours to work. Mailgun will email you when your domain is verified.

[How do I change my domain's email settings?](🔗)

# Step 3. Get your Credentials

Next, in Mailgun go to [Sending > Domains](🔗) and click the domain you are setting up with email:


Select SMTP


Save the following data: **Domain**, **Username**, and **Default password**.

In mailgun under [Settings > API Keys](🔗) use the **Private API key** for the OneSignal **API KEY** Field.

Make sure you are not blocking the OneSignal Server API keys under "IP Whitelist".

Recommended to keep this section blank. However, if you use it add `` and `` to make sure it is not blocked.


Your Mailgun API key and SMTP credentials are like a password. Keep them safe and **do not share them**.

# Step 4. Enable Email Messaging

In OneSignal, go to **Settings > Platforms > Email**

Next, you must configure your email settings. Select **Mailgun** as the provider, and paste in the **Domain** you set up with Mailgun, **Private API key**, SMTP Username, and SMTP Password (aka **Default Password**) you just copied in above steps.

OneSignal FieldMailGun Key
Default SMTP LoginUsername
Default passwordDefault Password
API keyPrivate API key

### Delivery Defaults

Add the **name** and **email address** that you want your emails to come from (you may override these when sending a message.

### Identity Verification

By default, [Identity Verification](🔗) is disabled, however we recommend using it. You can enable Identity Verification here if you can support it.


## How do I set up OneSignal if I already have an active Webhook in Mailgun?

To simplify setup and be able to access email delivery statistics, OneSignal will automatically configure Webhooks with Mailgun. Unfortunately, Mailgun only supports a single webhook for a given account. OneSignal requires webhooks to use Email Messaging, which may conflict with webhooks previously set up (e.g. for an analytics integration).

If you need the webhook you previously set up, you should <a href="" class="contact-support">contact us</a> for possible workarounds.

If you do not need the webhook you previously set up, you must disable it.

### Why are urls in the email not working?

Please see Mailgun's docs on this here: https://help.mailgun.com/hc/en-us/articles/360011566033-How-to-Enable-HTTPS-Tracking-Links

# MailGun Troubleshooting

## Emails not sending

In your MailGun Account under Sending > Logs, search the dates you sent the email. Click the email and check the `delivery-status` > `description` and error `code` for more details.

### Status Message: unable to connect to MX servers:

This means Mailgun tried to contact the mail server for that email address, but the MX server did not respond. You may be on a lower tier plan with Mailgun and need to upgrade or have a configuration error for the MX record, check your DNS settings to make sure it is setup correctly.