Configuring Mailgun with a Google Domains Account
Introduction
This guide provides step-by-step instructions for connecting your Mailgun account to a domain that is registered with Google Domains. You will learn how to add the necessary DNS records to enable email sending through Mailgun while preserving any existing email services on your domain.
Prerequisites
Before you begin, you should have a domain registered with Google Domains and have signed up for a Mailgun account.
Step 1: Add Your Domain in Mailgun
Log in to your Mailgun account. Navigate to the Sending section and select the option to add a new domain.
You have a choice to make regarding which domain to configure:
- Main Domain: Use your primary domain (e.g., companyname.com). Note that this is not recommended if you are already using this domain for Google Workspace or another email service provider, as it can cause delivery conflicts.
- Subdomain: Use a dedicated subdomain (e.g., mg.companyname.com or replies.companyname.com). This is the recommended approach to avoid disrupting existing email services.
When adding the domain, be sure to select the US region and not the EU region. Click the button to add the domain.
Step 2: Access DNS Settings in Google Domains
Log in to your Google Domains account at domains.google.com. Select the domain you are configuring from your list of domains. Click on the DNS option in the left-hand navigation panel. This is where you will add all the required DNS records.
Step 3: Add the SPF TXT Record
In the DNS management area, create a new record.
- Host name: Enter @ if you are using your main domain. If you are using a subdomain (e.g., mg.companyname.com), enter only the subdomain part (e.g., mg).
- Type: Select TXT from the dropdown menu.
- Data: Paste the first TXT record value provided by Mailgun, which will look like: v=spf1 include:mailgun.org ~all.
After filling in the fields, do not click Save yet. Instead, click the option to create another new record.
Step 4: Add the DKIM TXT Record
Create another new DNS record.
- Host name: This value is provided by Mailgun. It will be a specific string that precedes your domain name. Carefully copy the entire value as shown in your Mailgun setup instructions.
- Type: Select TXT from the dropdown menu.
- Data: Paste the second, longer TXT record value provided by Mailgun.
Again, do not save yet. Click to create a new record.
Step 5: Add the MX Records
Create a new DNS record for mail exchange.
- Host name: Enter @ if you are using your main domain. If you are using a subdomain (e.g., mg.companyname.com), enter only the subdomain part (e.g., mg).
- Type: Select MX from the dropdown menu.
- Data: Google Domains allows you to add multiple values to a single MX record. Enter the first value as 10 mxa.mailgun.org. Then, click the option to add more to this record and enter the second value as 10 mxb.mailgun.org.
Do not save. Click to create the final new record.
Step 6: Add the CNAME Record
Create the last DNS record.
- Host name: The host name will be provided by Mailgun and is typically formatted like email.mg for a subdomain or email for a main domain.
- Type: Select CNAME from the dropdown menu.
- Data: Enter mailgun.org.
Step 7: Save and Verify DNS Configuration
Now that all five DNS records have been entered, click the Save button in Google Domains.
Return to your Mailgun account and click the button to verify your DNS settings. DNS changes can take some time to propagate across the internet. If not all records are immediately verified, wait a short while and click the verify button again.
Step 8: Final Setup in Your CRM
Once all DNS records show as verified in Mailgun, copy your Mailgun API key from your account. Navigate to the email or SMTP settings within your CRM and paste this API key to complete the integration. It is a good practice to send a test email from your CRM to confirm that the setup is working correctly.
Frequently Asked Questions
Why does Google Domains only need one MX record entry?
Google Domains has a feature that allows you to add multiple MX server addresses to a single record, which is why you add both mxa.mailgun.org and mxb.mailgun.org to the same MX record.
Will this setup affect my existing Google Workspace email?
If you configured a subdomain for Mailgun (e.g., mg.yourdomain.com) and left your main domain's MX records for Google Workspace untouched, your existing email service will not be affected.
How long does DNS propagation take?
Propagation is usually fast but can sometimes take a few hours. If verification fails initially, wait and try again later.
What is the priority value for the MX records?
The priority for both Mailgun MX records should be set to 10.
What should I do after DNS verification is complete?
After verification, add your Mailgun API key to your CRM's email settings and send a test email to confirm everything is working.