Integrating MailGun

1. Add Domain

MailGun will require you to have your own domain registered, and access to DNS configuration for the domain.

Open https://app.mailgun.com/app/domains and click on the Add New Domain button. Enter a subdomain of your main domain (for example mg.yourdomain.com) even if you don't have it set up yet, as long as it's unique to MailGun and not currently in use.

Follow the instructions on the page to add TXT, MX and CNAME records as indicated. MailGun provide help links for a variety of service providers. You will need to configure all three of these for Campaign Refinery to track your campaigns effectively.

Once completed, you may need to wait up to 48 hours for domain verification to occur, although this usually takes far less time.

2. Create API Key

Once your domain has been created, open https://app.mailgun.com/app/domains and click on the domain. Scroll to the top of the page and look for an information block containing your IP Address, SMTP Hostname, etc. One of the settings will be an API key beginning with "key-". Copy this key as you will need it for Campaign Refinery.

If you do not see a key, open https://app.mailgun.com/app/account/security and click to the Security tab. You should see your API key listed there.

Open https://app.campaignrefinery.com/settings/eds and click + Email Service before selecting Mailgun from the drop-down menu. Give your service a unique name and paste your API key into the API Key field. When you save, Campaign Refinery will set up Webhooks for you.

3. Webhooks

Campaign Refinery will normally set these up for you automatically once you enter your API key. If it does not, you can set the webhooks up manually by following these steps.

Open https://app.campaignrefinery.com/settings/eds again, and find the new Mailgun service you set up in Step 1 above. At the top of the page, look out for a block similar to the following and copy the URL supplied.

Open https://app.mailgun.com/app/webhooks and paste the URL into all of the Legacy Webhooks fields listed.