# Google Domain Setup

### Introduction

Setting up custom domains with Mailgun can be a bit challenging for some users. This guide aims to simplify the process, using a video tutorial as a reference. By the end, you'll have a clear understanding of how to set up Mailgun custom domains, particularly with Google, though the principles can be applied to any DNS provider.

### Overview

The process involves:

1. Logging into Mailgun and your DNS provider (Google in this example).
2. Creating a subdomain in Mailgun.
3. Adding the necessary DNS records in your DNS provider.
4. Verifying the DNS records in Mailgun.

1\. Sign up for [Mailgun.com](https://signup.mailgun.com/new/signup)

2\. Check your email inbox to verify the email address

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284382834/original/93q62at2bi41NnpFtGv2FEPRQFFSRfxR7w.png?1677635327" alt=""><figcaption></figcaption></figure>

<br>

3\. Login to Mailgun, Click on **Sending** > **Add New Domain**<br>

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284382836/original/dX85fHXCrcdjQS7AUBN05K-nzvcunlx1CQ.png?1677635327" alt=""><figcaption></figcaption></figure>

4\. If your domain is companyname.com, you can either set up the main domain or subdomain with Mailgun.&#x20;

A. Main domain:

* If you are adding the main domain,[ it should not be used with Gsuite, or any other email provider](https://help.mailgun.com/hc/en-us/articles/203357040-Can-I-Use-the-Same-Domain-Name-for-Mailgun-and-for-Google-Apps-Or-Another-Email-Server-)&#x20;

&#x20;   Subdomain:

* To set up the subdomain with Mailgun, you can type **ANYTHING\_HERE**.companyname.com
  * Examples:
    * mg.companyname.com
    * replies.companyname.com
    * support.companyname.com

B. Please set up the domain or subdomain under US, **not EU. not EU. not EU.**&#x20;

C. Click on **Add domain**

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284382833/original/orhf_0AVhwlQvuxlv2cPV72PZBV30Ec4gw.png?1677635326" alt=""><figcaption></figcaption></figure>

<br>

5\. Now log in to your DNS records based on where you get the domain and add the 5 DNS records

* Log in to [domains.google.com](https://domains.google.com/)
* Click into the domain you are trying to set up
* Click DNS on the left panel, we are going to add 5 DNS records

Copy the first TXT record here **v=spf1 include:mailgun.org \~all**

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48243542584/original/jduaWZZKo0s-PYGnVfTYxkAaGSceLswDuQ.png?1659727406" alt=""><figcaption></figcaption></figure>

### To add the 1st TXT record <a href="#to-add-the-1st-txt-record" id="to-add-the-1st-txt-record"></a>

Host name:

* Depending on the subdomain you are trying to set up, if you are trying to set up
  * [mg.companyname.com](https://mg.companyname.com/) The host name will be **mg**
  * [replies.companyname.com](https://replies.companyname.com/) The host name will be **replies**
* If you are setting up a **main** domain like companyname.com, the host name will be **@**

Type: Select **TXT** from the dropdown

Data: we will paste the first copied TXT record here **v=spf1 include:mailgun.org \~all**

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48243542124/original/92-SiILtsZ5kfbsAEFFhKKjKEM8sGjIWEQ.png?1659727285" alt=""><figcaption></figcaption></figure>

Don't click save yet, 4 more new records to add

Once you are done with the 1st record, click **Create new record**

### To add the 2nd TXT record <a href="#to-add-the-2nd-txt-record" id="to-add-the-2nd-txt-record"></a>

Host name:

it's a bit tricky but the key here is to copy everything from the beginning until the subdomain part, **do not copy the main domain**

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48243542908/original/5vSFtNLEoaRQt2aK8L4rniJCWjLDJy6Vmg.png?1659727560" alt=""><figcaption></figcaption></figure>

Examples: **copy the highlighted part**

Example 1 using subdomain

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48243543383/original/LybPtPP4joO7bl9IEDJ1fwxnIvEiXCedvA.png?1659727679" alt=""><figcaption></figcaption></figure>

Example 2 using main domain:

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284378839/original/6xJR3U2ek0CgVESacXXEwkHcgsLaOXbjhQ.png?1677631543" alt=""><figcaption></figcaption></figure>

Type: Select **TXT** from the dropdown

Data: we will paste the second long TXT record here <br>

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48243543480/original/SA3H2iuimeXJJUdD5n5KAwd7ZwCI3qt5gA.png?1659727710" alt=""><figcaption></figcaption></figure>

### To add the MX records, click **Create new record** <a href="#to-add-the-mx-records-click-create-new-record" id="to-add-the-mx-records-click-create-new-record"></a>

Host name:

Depending on the subdomain you are trying to set up, if you are trying to set up

[mg.companyname.com](https://mg.companyname.com/) The host name will be **mg**

[replies.companyname.com](https://replies.companyname.com/) The host name will be **replies**

If you are setting up a **main** domain like companyname.com, the host name will be **@**

Type: Select **MX** from the dropdown

Data: paste the following data

* Copy and paste **10** [**mxa.mailgun.org**](https://mxa.mailgun.org/)
* Click **+Add more to this record**
  * Copy and paste **10 mxb.mailgun.org**

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48243544215/original/laPv0qzJMIw-tvzuWSaNoZUh1BosRw4EOg.png?1659728081" alt=""><figcaption></figcaption></figure>

### To add the CNAME record, click **Create new record** <a href="#to-add-the-cname-record-click-create-new-record" id="to-add-the-cname-record-click-create-new-record"></a>

Host name:

Depending on the subdomain you are trying to set up, if you are trying to set up

[mg.companyname.com](https://mg.companyname.com/) The host name will be **email.mg**

[replies.companyname.com](https://replies.companyname.com/) The host name will be **email.replies**

If you are setting up a **main** domain like companyname.com, the host name will be **email**

Type: Select **CNAME** from the dropdown

Data: copy and paste **mailgun.org**

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48243543931/original/4TQk2kmsk4suUaSdEwDrhVPLhdT8fYRTiw.png?1659727913" alt=""><figcaption></figcaption></figure>

Now that you have added 5 DNS records, click SAVE!

Go back to Mailgun and click **Verify DNS Settings**

Click the same button to **Verify DNS Settings** again if some records are still not showing the green checkmark

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48243544863/original/fZ4MWAp_hBYkuUM9L9YEuCRqwG5FLmD8Yw.png?1659728463" alt=""><figcaption></figcaption></figure>

### Conclusion

Setting up custom domains with Mailgun is a straightforward process once you understand the steps. This guide, combined with the video tutorial, should provide you with all the information you need to successfully set up your custom domain. Remember, while this example used NameCheap, the principles remain the same for other DNS providers.
