🔌Connect Mailgun API

Watch our Mailgun API introduction video then read through our easy to follow documentation with more details below:

Unlike SMTP Relay, API integration must be customized for each ESP. If you are a customer and want an API integration for your favorite ESP, please open a support ticket.

API integrations are bidirectional

To track real-time delivery progress natively in your platform including bounce and complaint rates, use an API implementation such as Mailgun, Sparkpost, or Amazon SES.

Velocity MTA, which comes free with your platform, also tracks real-time delivery over your own IP Addresses.

While logged in to the backend as administrator, click the connect menu, select Mailgun API, then click Add Mailgun Account.


Give your API connection an internal name. This will only be seen by you and is for management purposes only.

Finding the correct API Key

You must use the private API key from the Mailgun user menu in the top right of the Mailgun interface, and NOT the Sending API Key from the Mailgun 'Sending' configuration.

Don't use the Sending API Key under the 'Sending' menu on Mailgun.

Adding your Mailgun API Key

Paste in your Mailgun private API Key.

Adding a sending domain to Mailgun

Before you can use your sending domain through the Mailgun API, you must add your domain to Mailgun and verify you're the owner.

Enter a base domain or subdomain

Most mailbox providers such as Gmail recommend using a subdomain, however, this decision is based on your own preferences and goals. Using 'mg' for 'Mailgun' is a common subdomain seen with Mailgun customers.

Verify ownership by adding DKIM/SPF authentication

It's not necessary to add the suggested MX records in order for your domain to be successfully verified. This decision is based on your own preferences and goals.

Follow Mailgun's instructions for adding DKIM/SPF verification records to your DNS provider.

Mailgun may need a moment to detect the changes you've made to your domain configuration. If it doesn't verify you right away, try again in 1-2 minutes.

We recommend you do not add Mailgun's open and click tracking, an optional additional step on the same page.

Add your verified domain to your platform

Once your domain has been successfully verified by Mailgun, add it to your platform exactly as it appears on Mailgun.

White-label tracking links

Unless you change your link domain, your admin_url domain will be used for your tracking links in your email messages. You can add a custom link to automatically match your domain branding for mail sent through this API connection, no further action is required beyond this step for it to work.

Make sure you point a DNS A record at your platform IP Address for your tracking link or it will not work.

Next Steps

Return to the getting ready to send page and follow the instructions to start using your newly configured Mailgun API connection:

Additional information

Webhook integration verification

After you send your first message successfully through the platform using your Mailgun API connection, you should start seeing webhooks appear under Sending -> Webhooks in the Mailgun interface. This means your integration is fully working.

Make sure you have the correct domain chosen

Next Steps

Return to the getting ready to send page and follow the instructions to start using your newly configured SMTP Relay connection:

👩‍💻Getting ready to send

Last updated