OwnMaily Docs

Mailgun

SMTP Providers

Mailgun is a well-established transactional email service with strong deliverability. It requires a verified sending domain and provides both an API and SMTP interface. OwnMaily uses the API.

Note: Mailgun requires your domain, not just an API key. You will need to add DNS records and wait for verification before you can send.

Step 1: Create an account

Go to mailgun.com and sign up. Mailgun requires a credit card but has a free trial period.

Step 2: Add your sending domain

In the Mailgun dashboard, go to Sending and then Domains. Click Add New Domain.

Enter a subdomain of your domain - Mailgun recommends using a subdomain like mg.yourdomain.com rather than your root domain. This keeps your main domain's reputation separate from your sending reputation.

Choose your region (US or EU) based on where you want email data processed.

Step 3: Add DNS records

After adding the domain, Mailgun shows you a list of DNS records to add. These include:

  • Two TXT records for SPF and DKIM
  • A CNAME record for tracking
  • An MX record (only needed if you want to receive replies through Mailgun)

Add the SPF and DKIM records to your DNS dashboard. The MX record and tracking CNAME are optional - skip them if you do not need them. Once added, return to Mailgun and click Verify DNS Settings.

Verification usually takes a few minutes but can take up to an hour depending on DNS propagation.

Step 4: Get your API key

In the Mailgun dashboard, go to API Keys (under your account settings in the top right). Copy your Private API Key.

You will also need your sending domain - the exact subdomain you added in step 2 (e.g., mg.yourdomain.com).

Step 5: Configure OwnMaily

In OwnMaily, go to Settings and find the SMTP section.

  1. Select Mailgun as your provider
  2. Paste your Private API Key
  3. Enter your Mailgun sending domain (e.g., mg.yourdomain.com)
  4. Select your region (US or EU)
  5. Set your From Email to an address on your sending domain (e.g., [email protected])
  6. Set your From Name
  7. Click Save

Step 6: Send a test email

Click Send test email in the SMTP settings panel and enter your email address. Confirm it arrives in your inbox.

If the test fails with a 401 error, your API key is likely wrong. If it fails with a domain error, your Mailgun domain may not be verified yet. Check the Domains page in your Mailgun dashboard.