Email Services • Mailgun • API Connection
Connect Mailgun with a Private API Key
Connect your Mailgun account so your agency can send email through verified Mailgun infrastructure. Add Mailgun as an Agency-level Email Service, select a verified US-region sending domain, and make it the Active provider for eligible sub-accounts.
What You'll Learn

Learn how to prepare a Mailgun domain, connect it with a Private API key, activate Mailgun for Agency-level sending, understand sub-account provider priority, validate the connection, and troubleshoot common setup issues.

Important

This integration uses your Mailgun Private API key. Treat the key as a secret and never expose it in screenshots, support tickets, documentation, or public messages.

1

What Is the Mailgun API Key Connection?

Connecting Mailgun lets the platform use your Mailgun account and verified sending domain for outbound email.

The Private API key authenticates the connection with Mailgun and makes eligible verified domains from the account available during setup. After saving the service, you must set it as Active before it becomes the Agency-level default.

2

Key Benefits of Connecting Mailgun

Connecting your own Mailgun account gives your agency more control over its email infrastructure while keeping provider management centralized.

  • Use Your Own Infrastructure: Send through your existing Mailgun account and verified domain.
  • Centralize Agency Setup: Use Mailgun as the default service for sub-accounts without their own provider.
  • Switch Providers: Save multiple Agency-level Email Services and change which service is Active when needed.
  • Support Sub-Account Overrides: Allow individual sub-accounts to use another provider when configured.
  • Support Reply Routing: Proper Mailgun receiving and DNS configuration can route supported replies back into Conversations.
3

Prerequisites and Limitations

Preparing Mailgun before connecting it prevents the most common issues with missing domains, authentication failures, and unexpected provider behavior.

Before you begin:

  • Have an active Mailgun account.
  • Have at least one verified Mailgun sending domain or subdomain.
  • Create the Mailgun domain in the US region.
  • Complete the DNS records required for your Mailgun configuration.
  • Have access to Agency View → Settings → Email Services.
  • Have the appropriate Mailgun Private API key.

Keep these limitations in mind:

  • Eligible verified Mailgun domains must be available from the US region.
  • Saving a Mailgun service does not automatically make it Active.
  • Only one Agency-level Email Service can be Active at a time.
  • A sub-account-specific provider takes priority over the Agency-level provider.
  • Inbound reply handling requires additional Mailgun receiving and DNS configuration.
  • Mailgun billing, volume limits, and provider-level restrictions are managed through Mailgun.
4

Mailgun Region and Domain Requirements

Eligible Mailgun domains appear during setup only when the domain is verified and configured in the supported Mailgun region.

  • Create the Mailgun domain or subdomain in the US region, not the EU region.
  • Confirm the domain shows as verified in Mailgun.
  • Complete the DNS records required by your Mailgun configuration.
  • Use a subdomain when you want Mailgun sending to remain separate from the primary domain's existing mailbox configuration.

Example: If your main domain is yourdomain.com, you can use a sending subdomain such as mg.yourdomain.com. This is especially useful when the root domain already receives mail through Google Workspace, Microsoft 365, or another mailbox provider.

Mailgun domain showing US-region configuration and verified status

5

How To Connect Mailgun at the Agency Level

Connecting Mailgun at the Agency level makes it available as the default sending service for eligible sub-accounts after the service is saved and activated.

Step 1: Copy Your Mailgun Private API Key

The Private API key authenticates the connection between the platform and the Mailgun account containing your verified sending domain.

  1. Sign in to Mailgun.
  2. Go to Settings → API Keys.
  3. Create a key if you do not already have an appropriate Private API key.
  4. Copy the key securely.

Security: Never include your Mailgun Private API key in screenshots, tickets, documentation, or chat messages. If a key is exposed, replace it in Mailgun and update the connected Email Service.

Step 2: Open Agency Email Services

Agency Email Services control the default sending provider used when a sub-account does not have its own email provider configured.

  1. Open Agency View.
  2. Click Settings.
  3. Select Email Services.
  4. Open the SMTP Service tab.

Interface Note: Depending on your current interface, this configuration area may also be labeled Advanced Settings.

Step 3: Add Mailgun

Add Mailgun as an Agency-level Email Service and select the verified sending domain associated with the Mailgun account.

  1. Click + Add Service.
  2. In the Add your own email service window, select Mailgun.
  3. Enter your Mailgun API Key.
  4. Select the verified Mailgun Domain.
  5. Save the Email Service.

If the domain is missing: Confirm it is fully verified in Mailgun, belongs to the account associated with the API key, and was created in the US region.

Step 4: Set Mailgun as Active

Saving the service adds Mailgun to your Agency account, but the Agency does not use it as the default provider until you activate it.

  1. Locate the Mailgun service you added.
  2. Click Set as Active.
  3. Confirm the change.
Email Services showing a configured Mailgun service and activation controls
6

How Agency and Sub-Account Email Services Work Together

Provider priority determines which Email Service actually sends email when both Agency-level and sub-account-specific configurations exist.

Provider Priority

1. Sub-account-specific default provider
2. Agency-level Active provider

If a sub-account has its own provider configured, that provider takes precedence. If it does not, the applicable Agency-level Active provider is used.

To review sub-account provider assignments, go to:

Agency View → Settings → Email Services → Location Settings

Agencies can also control whether sub-accounts are allowed to add their own Email Services from:

Agency View → Settings → Email Services → Advanced Settings

Agency Email Services Advanced Settings showing controls for sub-account email service access
7

How To Validate Your Mailgun Connection

Testing Mailgun after activation confirms that the expected provider and sending domain work before you depend on the configuration for campaigns, workflows, or regular conversations.

  1. Confirm Mailgun shows as Active under Agency View → Settings → Email Services.
  2. Confirm the expected verified Mailgun domain is selected.
  3. Open a sub-account that should use the Agency-level provider.
  4. Create or open a test contact using an email address you can access.
  5. Send a test email from the contact conversation.
  6. Confirm the message is received.
  7. Reply to the email if you also want to test inbound reply handling.
  8. Confirm the reply appears in Conversations.

Outbound works but replies do not: Review the Mailgun receiving route, webhook, and inbound DNS configuration. A successful API connection alone does not configure inbound reply routing.

8

Troubleshooting

Most Mailgun connection issues come from domain verification, region selection, API authentication, provider priority, or inbound-routing configuration.

The Mailgun domain does not appear
  • Confirm the domain belongs to the Mailgun account associated with the API key.
  • Confirm the domain is fully verified.
  • Confirm the domain was created in Mailgun's US region.
  • Confirm the required DNS configuration is complete.
Mailgun is saved but email uses another provider
  • Confirm the intended Mailgun service is marked Active.
  • Check whether the affected sub-account has its own default provider configured, which takes priority over the Agency-level provider.
The API key cannot retrieve domains
  • Confirm you are using the Mailgun Private API key.
  • Confirm the key belongs to the expected Mailgun account.
  • Confirm the key has not been deleted, replaced, or revoked.
  • If Mailgun IP restrictions prevent the platform from retrieving domain information, temporarily adjust the restriction, retry the connection, and restore the restriction after validation.
Mailgun IP access restriction settings used when troubleshooting API domain synchronization
Email sends successfully but replies do not appear in Conversations
  • Check the Mailgun receiving route and webhook.
  • Confirm the Mailgun MX configuration is correct for the inbound setup.
  • Confirm the expected domain is associated with the correct sub-account.
  • For cold inbound email, use a unique dedicated domain or subdomain for the appropriate sub-account so inbound messages route to the intended destination.
9

Frequently Asked Questions

Q: Should I use the Mailgun Private or Public API key?
Use the Private API key. The Public API key does not authenticate this Mailgun provider connection.
Q: Why doesn't my EU-region Mailgun domain appear?
Eligible verified Mailgun domains for this integration must be configured in the US region. Configure a US-region domain or subdomain instead.
Q: Why doesn't my verified domain appear in the dropdown?
Confirm the domain belongs to the Mailgun account associated with the API key, is fully verified, and is configured in the US region. Also review any Mailgun IP restrictions that may block domain retrieval.
Q: Can I save more than one Mailgun service?
Yes. You can save multiple Agency-level Email Services, but only one Agency-level service can be Active at a time.
Q: Does Agency-level Mailgun apply to every sub-account?
It becomes the default for eligible sub-accounts that do not have their own provider configured. A sub-account-specific default provider takes precedence.
Q: Why can't a sub-account add its own Email Service?
Agencies can control whether sub-accounts can add Email Services. Review Agency View → Settings → Email Services → Advanced Settings.
Q: Can I switch back to LeadConnector Email after activating Mailgun?
Yes. Return to Agency View → Settings → Email Services and set the LeadConnector Email System as the Active Agency-level service.
Q: Does connecting Mailgun automatically configure email replies?
No. Reply handling also depends on the correct Mailgun receiving route, webhook, and inbound DNS configuration.
Q: Can the same Mailgun domain be used across multiple sub-accounts?
Supported Mailgun setups can use the same account and sending domain across multiple sub-accounts. For cold inbound email, use a unique domain or subdomain for the appropriate sub-account so incoming messages can be routed correctly.
10

Need Help?

  • Domain not listed: Confirm the Mailgun domain is verified, belongs to the correct account, and is configured in the US region.
  • Mailgun is saved but not being used: Confirm the service is marked Active and check whether the sub-account has its own provider configured.
  • Domains cannot be retrieved: Verify the Private API key and review Mailgun IP access restrictions.
  • Email sends but replies are missing: Review Mailgun receiving routes, webhooks, MX records, and the domain assigned to the sub-account.
  • API key was exposed: Replace the key in Mailgun immediately and update the connected Email Service with the new key.