All Collections
Email Connection
External SMTP
How to connect Mailgun to Woodpecker
How to connect Mailgun to Woodpecker

Mailgun and Woodpecker: Step-by-Step setup

Weronika Wróblewska avatar
Written by Weronika Wróblewska
Updated over a week ago

This guide assumes that you have at least basic understanding of what a domain, DNS, SPF and DKIM are. If you're not sure what they taste best with, please take a moment to read about them, following the links for each.

Head over to our blog to learn about the benefits of Connecting External SMTP from Mailgun to Woodpecker »

Before you start, note that we use these two terms in the guide:

  1. Primary domain

  2. Subdomain

Primary domain is the one you use on a daily basis to send business emails from Woodpecker (for example,

When using Mailgun, it’s better to come up with a subdomain (for example,, and set it up in Mailgun settings. This will also require you to set up the subdomain in your DNS settings panel.

To create a subdomain in Mailgun, add a prefix before your primary domain name in the Mailgun panel.

That way, if your primary domain name is “”, add a prefix, such as “m.” (followed by a dot) to your primary domain name.

So if your domain name is: in Mailgun you would use a subdomain:

Important: the subdomain address will not be visible to your email recipients. You only use it for Mailgun to be able to set all the required records properly in order to keep your deliverability as high as possible.

Mailgun and Woodpecker: Step-by-Step setup

1. Set up and warm up your domain

Before you start using Mailgun to send your emails, it’s crucial to have a properly prepared domain. We recommend using a separate domain for cold outreach, so if you don’t have one yet, set it up.

Choose whatever domain registrar and/or DNS server you prefer. Configure your DNS and take some time to warm up the domain before sending your cold emails.

Once your domain is ready for sending emails, you can set it up with your Mailgun account.

2. Add a subdomain to Mailgun

Image showing arrow poitning to "Add New Domain" button in Mailgun settings
  1. From Mailgun "Dashboard", navigate to the "Domains" panel.

  2. Click “Add New Domain”. Type in the name of your subdomain. As described above, it’s safer to use a subdomain rather than your primary domain address.

    So let’s say, the name of your domain is In Mailgun, type in – this will be your subdomain for cold emails.

  3. Checkmark Create DKIM Authority box.

  4. Click "Add Domain".

Image showing adding the domain in Mailgun

3. Check your domain’s configuration

  1. Log into your domain management account at your domain registrar.

  2. Verify your DNS records.

First, establish where your DNS records are being hosted. DNS records are usually hosted by your domain registrar, for example, GoDaddy or

However, sometimes you can buy a domain from a domain registrar like GoDaddy or any other, but your DNS server is hosted externally by a web hosting company.

4. Copy DNS records from Mailgun to your domain settings

This step is necessary to allow Mailgun to send emails from your domain on your behalf.

It will require you to copy 4 types of records from Mailgun to the DNS settings of your domain:

  • SPF,

  • DKIM,

  • MX,

  • CNAME.

The screenshots below come from the panel at We use it only as an example here. If you use another domain registrar, you will see a different panel, but look for the same type of settings.

4.1. Open the DNS settings at your domain account

After logging in, you'll see your Account Overview. Click your domain's name to see your Domain Details.

Account Overview on the website

Find the DNS section and click Manage DNS Records. Here's the view:

Image with arrow pointing to "Manage DNS Records"  in the Domain Details tab on website

4.2. Check your SPF records at your domain account

DNS setup for your domain should now include Mailgun in the SPF (TXT) records of your domain.

It will read “”, just like in the screenshot below:

Image with arrow pointing to the SPF record with DNS setup

4.3. Find your TXT records in Mailgun

  1. Go to your Mailgun account,

  2. Open "Sending" → "Domains Settings",

  3. Navigate to "DNS records".

  4. Find TXT records (known as SPF and DKIM) section.

  5. Copy the TXT records.

Image showing TXT records in Domain Settings in Mailgun

4.4. Paste in the TXT records from Mailgun to the DNS settings of your domain

TXT records (SPF)

DNS settings panel (here:

v=spf1 ~ all

Image showing SPF record in the DNS settings

Note: It’s important to make sure the SPF record is set up for both your domain and subdomain.

1. Copy the SPF value from Mailgun and paste it into the DNS records of your domain (i.e.

2. Define a new record for your subdomain:

  • choose Type: TXT

  • paste in the subdomain as Host

  • paste the SPF record as Answer

3. Click on Add record to save the record for the subdomain (e.g.

DNS settings panel (here:


Copy the DKIM record from Mailgun into your DNS records. It should be the exact same record in both places.

DNS settings panel (here:

MX & CNAME records (optional)

The MX and CNAME records are optional, however:

  • If you want to use the Mailgun bounce tracking, you need to set up the MX record only for your subdomain.

  • If you plan on tracking opens, clicks, and including the unsubscribe links in your emails, you need to set up the CNAME record.

Important: Woodpecker tracks opens and clicks and it allows you to add the Unsubscribe link to your emails, so if you’d rather use the built-in tools in Woodpecker (which is recommended), you can skip this entire step.


Set two MX records only for your subdomain:

In Mailgun, you’ll find two MX records. You need to copy both of them to your DNS settings.

Mailgun dashboard

How to copy an MX record from Mailgun panel to DNS settings:

Go to your DNS settings, and define a new record only for your subdomain:

  • choose Type: MX

  • paste the subdomain as Host

  • paste the MX record from Mailgun as Answer

Click on “Add record” to save the record for the subdomain (i.e

Remember to perform that action for both MX records. Copying just one is not enough. Here’s what it should look like in your DNS server settings:

DNS settings panel (here:


Copy the CNAME record from Mailgun only to your subdomain in DNS settings.

1. Copy the CNAME value from Mailgun.

Mailgun Dashboard

2. Go to your DNS settings and define a new CNAME record for your subdomain:

  • choose Type: CNAME

  • paste the subdomain as Host

  • Paste the CNAME record from Mailgun as Answer

DNS settings panel (here:

4.5 Check the settings you’ve just updated by clicking on “Check DNS Records Now”

If you did everything right, you’ll see a green mark next to it.

Mailgun dashboard

5. Connecting Mailgun to Woodpecker

5.1 Choose your email provider

  1. Go to Woodpecker, navigate to Settings → Email Accounts.

  2. Click Add Email Account.

  3. Choose your email provider or click Manual Connection

Manual connection button highlighted when choosing the email provider

5.3 Connect your SMTP from Mailgun

1. In the SMTP Server data section in Woodpecker, choose Mailgun from the dropdown list of SMTP providers, just like in the screenshot below.

2. Copy your subdomain name (for example, and paste it in Woodpecker into the API domain field.

3. Add your Private API key into the API key field.

SMTP Server data for Mailgun

Where can you find the API Key?

  1. Go to Mailgun Settings.

  2. Click API Security.

  3. Copy Private API key.

  4. Paste it in Woodpecker into the API key field.

5.2 Fill out IMAP server data

Please note: the fields will be empty only if you chose “Other” in the dropdown list. If you’re using a default IMAP from Google, Office 365, or Exchange, these will be set to their respective default for you.

IMAP Server data  for Mailgun - other

5.4. Click "CONTINUE"

There you go! You’ve just connected your email account with Mailgun SMTP to Woodpecker.

Successful connection window

To test the SMTP connection, create a campaign in Woodpecker, add at least one email address as your prospect, and click the RUN button to send a test email to this address.

Did this answer your question?