Atsushi Yamamoto

Build a custom email with Mailgun & Namecheap and manage it from Gmail


I’ve used Zoho Mail for quite some time but was never happy with their UI. With some googling, I found that Mailgun makes it pretty easy for me to set up a custom email that I can manage on Gmail with my own domain from Namecheap for free!

In this tutorial, we’ll be going over how I created my own personal email ( from the Namecheap domain I purchased ( How it works is that we will create a new receiving and sending route specifically for our new email which will then be forwarded to existing Gmail address for us to read. From there we’ll add a new account on Gmail where we can send or reply to a new email straight from Gmail!

Registering a domain on Mailgun

First, go to Mailgun website and make an account. The username and email that you use here don’t affect this new email we’ll be making so no pressure.

Mailgun has a free plan for up to 10,000 emails per month as of June 2019, and if you ask me that’s more than enough for my personal use.

After you’ve logged in, Go to Sending > Domains from the sidebar. Click on “Add New Domain” from that page (aka here).

Here’s what it might look like.


Although they recommend using a dedicated subdomain for the email, using the main domain as worked for me.

When you add a new domain the page will jump to DNS setting page. Leave this page in one tab, and open a new tab with Namecheap to do the next step simultaneously.

Adding DNS records

Jump to your domain’s DNS setting page on Namecheap. Before we put in any new DNS records, let’s check what the Mailgun says to do.


(Grayed out my own DNS record values)

DO NOT copy Mailgun’s hostname field into Namecheap’s “Host” value! (I waited 48 hours until I realized I did something wrong :/). Turns out Namecheap expects it’s own domain to be written as @ sign. This means where Mailgun expects field remove, so on Namecheap you would write mailo_domainkey only. After you fill it out this way the form should look something like this:


Do the same operation for MX Records and CNAME! (MX record’s hosts should be @, and CNAME record’s host field would be written as email instead of what Mailgun says to write which is

Sweet! Now that DNS records are added, let’s refresh the Domain Setting page couples times. Note that Namecheap claims DNS records update sometimes take couple hours to 48 hours (for me it took only a couple minutes).

If everything is working on Namecheap side at this point, you should see a green check mark along with different requirements!


Setting up a receiving route

We’re ready to set up a receiving route on Mailgun. Go to Receiving setting page from the sidebar, and click on Create Route (aka here). This page is where we make our new email forward to existing Gmail address.

I decided to use “Match Recipient” option but “Catch all” should work as well. For the recipient we’ll put our new email ( for me). For the Forward section we’ll put our existing Gmail address. Here’s what it might look like when this part of the page is done.


Set the priority to a low number (I use 1), and we’re good to go! Click “Create Route”, and we’ll move on to sending part.

Setting up a sending route

Go to Sending > Domain Settings from the side menu. Find SMTP Credentials tab header. Once you’re in this page, click on New SMTP User. This is where we get to define our new custom email! Very exciting. Go ahead and create new credentials.


It will give you a password, and be sure to store it somewhere safe since they won’t show it to you again!. We’ll be using other details included on this page to set up a new account on Gmail.

Adding a new account on Gmail

Go to Gmail inbox, and go to Settings page from the gear icon. Click on Account and Import tab, and go to Add another email address link from Send mail as subsection.


On a new pop up, put your new address into an email field then click next. On the next page, we’ll put what SMTP Setting page on Mailgun suggested to put. Use, your new email, and previously saved password in each field. Here’s what it may look like.


When you click Add Account, Gmail will send a confirmation email to the new email which should be forwarded to your own Gmail address! Do the confirmation steps and Gmail is set up to send new emails from your custom domain email!


And that’s it! Your email is ready to be used.

Feel free to email me at with your brand new email to let me know it works, or if you have any feedback on this post!