Engineering • April 13, 2026

How to Migrate from Mailgun to Axene Mailer (Step-by-Step)

Axene Team Core Team
How to Migrate from Mailgun to Axene Mailer (Step-by-Step)
Published April 13, 2026
Read time 6 min
Words 1,150
Sections 0

Migrating your email infrastructure is one of those tasks that sounds straightforward but can quickly become complex. If you are running a startup or business in Africa and currently using Mailgun, you have probably felt the friction: USD billing that fluctuates with exchange rates, support that operates in US/EU timezones, and deliverability that was never optimized for African inboxes.

This guide walks you through migrating from Mailgun to Axene Mailer step by step. We will cover DNS changes, API migration, template conversion, and testing to make sure nothing breaks during the switch.

Why Migrate from Mailgun?

Mailgun is a solid platform. It has been around since 2010 and powers email for thousands of companies globally. But for businesses operating primarily in Africa, there are real pain points:

  • Pricing in USD means your email costs fluctuate with the KES/USD exchange rate. A bill that was KES 4,500 last month could be KES 5,200 this month with no change in volume.
  • No M-Pesa billing. You need a USD-denominated credit card or PayPal, which many Kenyan SMEs do not have.
  • Mailgun data centers are in the US and EU. Emails to recipients on Safaricom, Airtel Kenya, or other African ISPs travel across continents before delivery.
  • Support operates during US business hours. If you hit a critical sending issue at 10 AM Nairobi time, you are waiting until evening for a response.
  • Deliverability was not tuned for African email providers. Spam filtering on local ISPs works differently, and Mailgun does not optimize for this.

Axene Mailer solves all of these. Pricing is in KES, billing is via M-Pesa, infrastructure is hosted locally, and the platform was built from the ground up for African deliverability.

Step 1: Set Up Your Axene Mailer Account

Sign up at mail.axene.io with your Google account. Once logged in, create your organization and add your first sending domain.

  1. Go to mail.axene.io and click "Sign in with Google"
  2. Enter your organization name (this is your business name)
  3. Navigate to Settings > Domains > Add Domain
  4. Enter your sending domain (e.g., notifications.yourcompany.co.ke)

Step 2: Update Your DNS Records

Both Mailgun and Axene Mailer require DNS records for email authentication. You will need to replace Mailgun DNS records with Axene Mailer records.

Remove Mailgun DNS Records

Log into your DNS provider (Cloudflare, Namecheap, etc.) and remove the following Mailgun records:

  • TXT record for SPF that references mailgun.org
  • CNAME records for DKIM (mailo._domainkey, etc.)
  • MX records pointing to Mailgun (if you were using Mailgun for inbound)

Add Axene Mailer DNS Records

In your Axene Mailer dashboard, go to Domains and click on your domain. You will see the required DNS records:

Record TypeNameValuePurpose
TXT@v=spf1 include:mail.axene.io ~allSPF authentication
CNAMEaxene._domainkeyProvided in dashboardDKIM signing
TXT_dmarcv=DMARC1; p=quarantine; rua=mailto:[email protected]DMARC policy

After adding the records, click "Verify Domain" in the Axene Mailer dashboard. DNS propagation typically takes 5 to 30 minutes. The dashboard will show green checkmarks once verification is complete.

Step 3: Migrate Your API Integration

If you are sending transactional emails via the Mailgun API, you will need to update your code. The Axene Mailer API is designed to be straightforward and developer-friendly.

Mailgun API (Before)

mailgun_send.py
import requests

def send_email_mailgun(to, subject, html):
    return requests.post(
        "https://api.mailgun.net/v3/YOUR_DOMAIN/messages",
        auth=("api", "key-XXXXXXXXXXXXXXXX"),
        data={
            "from": "App <[email protected]>",
            "to": [to],
            "subject": subject,
            "html": html,
        },
    )

Axene Mailer API (After)

axene_send.py
import requests

def send_email_axene(to, subject, html):
    return requests.post(
        "https://mail.axene.io/api/v1/send",
        headers={
            "Authorization": "Bearer YOUR_API_KEY",
            "Content-Type": "application/json",
        },
        json={
            "from": {"email": "[email protected]", "name": "App"},
            "to": [{"email": to}],
            "subject": subject,
            "html": html,
        },
    )

The key differences: Axene Mailer uses JSON request bodies instead of form data, Bearer token authentication instead of HTTP Basic Auth, and a structured from/to format that supports names alongside email addresses.

Node.js Example

axene_send.js
// Axene Mailer - Node.js
const sendEmail = async (to, subject, html) => {
  const response = await fetch("https://mail.axene.io/api/v1/send", {
    method: "POST",
    headers: {
      "Authorization": "Bearer " + process.env.AXENE_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      from: { email: "[email protected]", name: "App" },
      to: [{ email: to }],
      subject,
      html,
    }),
  });
  return response.json();
};

Step 4: Migrate Email Templates

If you have HTML email templates in Mailgun, you can use them directly in Axene Mailer. Axene Mailer accepts standard HTML for transactional emails, and also provides a drag-and-drop template builder at templates.axene.io for campaign emails.

  • Export your templates from Mailgun (Settings > Email Templates)
  • For simple transactional templates, pass the HTML directly via the API
  • For campaign templates, use the Axene Templates builder to recreate them visually
  • Axene Templates uses MJML under the hood, ensuring your emails render correctly across all email clients

Step 5: Set Up Webhooks

Mailgun and Axene Mailer both support webhooks for tracking email events. Update your webhook endpoints:

EventMailgun WebhookAxene Mailer Webhook
Delivereddeliveredemail.delivered
Openedopenedemail.opened
Clickedclickedemail.clicked
Bouncedfailed (permanent)email.bounced
Complainedcomplainedemail.complained
Unsubscribedunsubscribedemail.unsubscribed

All Axene Mailer webhooks are signed with HMAC-SHA256, and the platform retries failed deliveries on an escalating schedule: 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 24 hours, 48 hours, and 72 hours.

Step 6: Test Before Switching

Before fully cutting over, run both systems in parallel for a few days:

  1. Send test emails to addresses on Gmail, Outlook, Yahoo, Safaricom, and Airtel
  2. Verify DKIM signatures are passing (check email headers)
  3. Confirm webhook events are being received correctly
  4. Monitor deliverability in the Axene Mailer analytics dashboard
  5. Once satisfied, update your production code to use the Axene Mailer API exclusively

Feature Comparison

FeatureMailgunAxene Mailer
Pricing CurrencyUSDKES
Payment MethodsCredit Card, PayPalM-Pesa, Card
Data CentersUS, EUAfrica-optimized
Free Tier100 emails/day (Flex)Contact for pricing
DKIM/SPF/DMARCYesYes + guided wizard
Template BuilderBasicDrag-and-drop (MJML)
Webhook RetriesYesYes (8-step escalation)
African ISP OptimizationNoYes
Support TimezoneUS hoursEAT (UTC+3)

Common Migration Issues

DNS Propagation Delays

After updating DNS records, give them up to 48 hours to fully propagate globally, although most providers update within 30 minutes. You can use dig or nslookup to check propagation status.

API Key Management

Generate your Axene Mailer API key in the dashboard under Settings > API Keys. Store it as an environment variable, never hardcode it in your source code.

Rate Limits

Axene Mailer rate limits are generous for most use cases. If you are sending high volumes (over 10,000 emails per hour), contact support to discuss your sending patterns and get your limits adjusted.

Wrapping Up

Migrating from Mailgun to Axene Mailer is a straightforward process that most teams can complete in an afternoon. The biggest benefits you will notice immediately are stable KES pricing, M-Pesa billing, and improved deliverability to African recipients. The API is clean and well-documented, and the support team operates in your timezone.

If you run into any issues during migration, reach out to [email protected] or book a call at meet.axene.io. We are happy to help you make the switch.