Integrating with MailGun

This section outlines the steps required to integrate with MailGun, allowing you to send emails using your own infrastructure and domains.

NOTE: On newer accounts, MailGun is sensitive to the volume of emails that are sent. By default, attempts to send all emails as quickly as possible, and this can cause MailGun to reject a subset of the emails. If this happens, these emails will be marked as Failed in your campaign’s results. More info. Send less than 20 payloads at a time to avoid this issue, or contact MailGun support to remove the limitation.

MailGun Preparation

This guide assumes you already have a MailGun account, and have purchased a domain that you wish to send emails from. We’ll be using Namecheap here to demonstrate the DNS changes, but the steps will be similar across other domain registrars.

Add Sender Authentication

  • Head to Domains in MailGun and select Add New Domain.

  • Enter your domain name and click Add Domain. We’ll be using

  • Inside Domain Settings under DNS Records, you’ll find the DNS records you need to configure to enable SPF and DKIM. Add the provided records to the DNS section of your registrar. NOTE Namecheap automatically appends the hostname, so only add the host’s prefix, as below.

MailGun DNS Settings

Namecheap DNS Settings

  • If successful, you should be able to hit Verify DNS Settings and see the status of your records change to Verified.

Generate API Key

  • Navigate to API security and click Add new key.

  • Give it a description such as MailGun Integration.

  • Make a note of the key displayed as you won’t be able to access it again.

Disable Tracking

  • Lastly, visit the Tracking section inside Domain settings and disable all tracking.


Add MailGun Integration

  • Back in, go to Settings and click Send with MailGun.

  • Enter a friendly name for this integration to help you recognise it later.

  • Enter the API key from the previous step, and the address you’d like to send the emails from. We added the entire domain to MailGun in the previous step, so we can use any address from that domain. The From and Reply to fields will be populated with this address.

Add Integration

  • Hit Add and you should be greeted with the message below. attempts to validate the supplied key, and will return an error if it can’t successfully authenticate to the API. If this happens, check that the correct key has been supplied.

Integration Added Successfully