Nothing looks weirder than a professional Twitter account listing a Gmail address for business contact. With the relative ease of setting up a custom domain for receiving email (coupled with how cheap it can be), I’m surprised more people don’t do it. Here’s my tutorial for how to set up a custom email address.
This tutorial will cover how to use Namecheap to get a domain name and how to set up Mailgun to handle all MX. I’ll be using Gmail for the “backbone” to actually take care of all the mail once it’s forwarded around.
A Word to the Wise
These email addresses are very flashy and look great. However, I would not use them to sign up for any service you’re going to use frequently, especially if that service involves your money. PayPal and online banking are both a heavy no-no. Reddit, Discord, Twitter, or any other platform that you use on a regular basis that would be an unfortunate breach are also no-nos.
If an attacker were to compromise your account you lease the domain with (in this case Namecheap), they could configure all incoming email to be routed to their servers. These emails include password reset requests and suspicious activity notices. It’s entirely possible you’d never know something was going on.
Please just sign up for stuff with a Gmail account.
For further reading, check out this article from @N about how he lost control of his one-character Twitter handle through the compromise of his GoDaddy account. He’s also got a great warning in that article that I’d highly recommend reading through.
The Perfect Domain Name
The domain name is the part after the @ in an email address. For postmaster@gmail.com, the domain name is gmail.com. For q@queue.bot, the domain name is queue.bot.
I personally recommend Namecheap for leasing domain names. They have a great selection of TLDs (extensions) at a fairly reasonable price. When leasing a domain name, you choose how many years to lease it for and pay up front. You can then manage that domain for however long you lease it. If you don’t pay to lease it for more years, the domain becomes available to the public again.
The key to a perfect domain name is that it should be short and memorable. You don’t want someone typing forever to enter your email address.
Best case scenario is your ideal domain name is available with a .com suffix because everyone knows what .com is. Unfortunately, .com has been around for forever and a lot of the good ones are already taken and are being resold privately for insane amounts of money.
A very modern thing to do, especially for email addresses or short links, is split your name up so that the domain extension is part of your name (e.g. queue.bot, redd.it, goo.gle, e.lga.to, etc). The extensions .is
, .us
, and.in
can make for some fun domain names.
In the world of esports, the .gg extension is on the rise. Unfortunately, these cost around $70/year to lease and you can find other domain names for much cheaper. However, a lot of the short and memorable .gg domain names are still available.
For this demonstration, I’ll go ahead and snag shelf.pw
and set it up.
Purchasing the Domain Name
Go ahead and head over to https://www.namecheap.com/domains/domain-name-search/ and type in domain names until you find one that’s available that you’d like to lease. You’ll see an “Add to cart” button if the domain is available.
After clicking the “Add to cart” button, press “View Cart” to continue with checkout.
On the checkout page, you can choose how many years to lease your domain as well as turn on the option to auto-renew.
You’ll also see an option to enable or disable WhoisGuard. When you register a domain, you have to attach personal details to the domain such as a physical address, a telephone number, and an email address. Ordinarily, these are publicly available and can be access with tools such as whois.org and whois.domaintools.com. With WhoisGuard enabled, the information is not directly viewable and any requests must be manually processed by Namecheap before your contact information is released. Now that it’s free, there’s pretty much no reason to not enable it.
From there, click the “Confirm Order” button on the right side of the screen.
You’ll be prompted to log in or sign up. If you’re making an account, don’t feel obligated to put your legitimate first and last name in the field. I typically put “Jeph” instead of “Jeff” so I know all emails addressing “Jeph” are scams.
After logging in, you’ll need to fill out an Account Contact Information form. The first thing you should do is untick the “I’m registering on behalf of a company” box.
After you scroll down, you’ll need to fill in physical address information, a phone number, and an email address. These are used in case of abuse originating from your domain so people can file complains, so I recommend you put something legitimate-ish. PO boxes are great for these fields, and a Google Voice phone number wouldn’t hurt either. Oh, and please make a fake email address or you will get loads of emails from people wanting to build your website. After that’s done, hit “Continue” at the bottom.
On the next page you’ll see the explanation of the mandatory contacts tied to the domain that I explained earlier. I recommend leaving everything on “User default account contact”. Hit “Continue”.
Now, you’re able to add payment information. You can use a card or PayPal to complete the purchase (I’ll use PayPal for this tutorial). At the bottom of the page you can set up automatic renewal, but I personally don’t do that. Your email will be notified (not just once) when your domain is about to expire. Hit “Continue”.
On the last screen you’ll be able to confirm your order before paying. From there, go ahead and finish up all payment prompts. After you’re doing with that, the order will process.
Congratulations! You can now control your domain for however long you leased it. We’re done with Namecheap for now, but we’ll be back soon.
At this point I’d recommend turning on 2FA for your Namecheap account. It adds an extra layer of security and is overall a really good idea.
Adding the Domain Name to Mailgun
Mailgun is going to be handling all the email receiving and routing. Go ahead and visit https://www.mailgun.com and sign up for an account.
On the “The Last Step” page, choose “Concept Plan”, or the pay as you go. My actual Mailgun account has 5 domains and countless addresses attached to it and I never go over 800 emails a month. In other words, you probably won’t need to worry about hitting that free 10,000 email per month limit. Hit “Go To Dashboard”.
You will need to verify your Mailgun account by visiting your email and attaching a phone number. I don’t think VoIP numbers (Google Voice, etc) work here, but your phone number won’t be publicly visible unlike the WHOIS records.
Again, I strongly recommend enabling 2FA on your account. 2FA can be managed from https://app.mailgun.com/app/account/settings.
Now, we need to add your domain name to Mailgun so that Mailgun can route email through it. To do that, click “Domains” on the left sidebar.
In the top right, click the “Add New Domain” button.
You can use a subdomain if you want to (something like mail.shelf.pw
or m.shelf.pw
), but I personally don’t. For me, it makes my email longer and harder to remember at no additional benefit. In this tutorial, I will NOT use a subdomain. Enter your domain name to the box, choose your region, and keep the “Create DKIM Authority” on default settings. Then, click “Add Domain”.
In my case, my domain was disabled. It’s not a huge deal, especially for a brand new account. To resolve the issue, make a support ticket and they will take care of you. The link to make a new ticket is https://app.mailgun.com/app/support/new.
After about 12 hours, my issue was resolved. shelf.pw
now has a yellow question mark next to it because we haven’t verified it yet. Let’s verify it.
Verifying the Domain Name
Click on your domain and you’ll be directed to the page to add some DNS records to your domain.
Go ahead and copy the first TXT value that starts with v=
and head to https://ap.www.namecheap.com/dashboard. From there, click “Manage” on your domain name.
On the right side of the top bar, click “Advanced DNS”.
Click the orange “Add new record” button at the bottom. From the dropdown, choose “TXT Record”. For the host, put @
. For the value, paste what you copied from Mailgun. Then, press the green check mark on the right side.
Go back to Mailgun and copy the second TXT record that starts with k=. Again, go back to Namecheap, “Add new record”, “TXT Record”. Instead of putting @ for the “Host” box, you’ll need to only put the bold part of the value from Mailgun. Copy the bold text from Mailgun (and do not include your domain name).
Paste the value into the Namecheap “Value” box, then press the green check mark. If you want, you can click “Check DNS Records Now” to make sure they’re set up correctly, but keep in mind record changes can take a few minutes to propagate through Namecheap’s network.
You’ll probably get kicked to another page after Mailgun thinks it looks okay, but go back to https://app.mailgun.com/app/sending/domains/your-domain-goes-here/dns to finish setup.
If you get an option to use the API or SMTP, click SMTP.
Next, we need to add the MX (mail exchange) records. Scroll down a bit until you see “Mail settings”, and from the corresponding drop down menu, choose “Custom MX”.
Now, set Host to @
, Value to mxa.mailgun.org
, and Priority to 10
. Go ahead and click “Save changes”.
After you hit “Save changes”, you’ll need to hit the “Add new record” button to add a new record with Host set to @
, Value set to mxb.mailgun.org
, and Priority set to 10
. Press the green check mark.
Head back to Mailgun and click the “Check DNS Records Now” button. If everything is set up correctly, you should see something that looks like this.
At this point, your domain is completely configured, so you can close out of Namecheap and move back to Mailgun.
Routes
Mailgun uses routes to figure out what to do with emails after receiving them.
On the left menu, choose “Receiving”. Then, in the top-right corner, choose “Create Route”.
Whenever a new email comes in, it’s going to be evaluated on every routing rule (also called a route) and handled appropriately. The first step in handling incoming email is figuring out how to identify it. We’ll use the “Expression type” dropdown to choose “Match Recipient”. In the box that appears, you can type whatever you want your new email to be. I’ll use business@shelf.pw
.
Next, scroll down and tick the “Forward” box to have the email be forwarded to another address. In this case, I’ll just have it forward to my Gmail account.
At the bottom of the page, you can set the Priority and Description for the route. Priority is used to figure out the order your routing rules are used to sort email, evaluating from newest route with lowest priority to oldest route with lowest priority. It’s not something we need to worry about.
Description is used to help you remember what the email is for (or really anything regarding the email). I use it to remind myself to delete throwaway addresses after I start getting too many emails through them. You can set that to whatever you want.
Finally, press “Create Route”. If all is set up correctly, you should be able to sign into your email and send an email to whatever you put in the “Recipient” field up above. Within a minute or two, it should arrive in the inbox you specified in the “Forward” section.
Credentials
Credentials are used to send emails through your custom domain.
From the left menu, choose “Domain Settings” under the “Sending” category. Then, click on “SMTP” credentials on the top bar.
Postmaster is the default credential that basically acts as an administrator. While you could just use this credential to send email, it’s better to restrict access to your domain by making a specific username/password for a specific sending address.
In the top right, click “New SMTP User”.
Go ahead and type whatever login you want. This is the email address that you will be sending your emails from. Again, I’ll use business@shelf.pw
.
A green box will appear in the top left that contains the automatically generated password. Copy this password with the copy button. I couldn’t figure out how to change this password, but that’s fine.
Now, head to your Gmail account and choose the settings cog from the right side. From the menu that appears, choose “Settings”. You should end up on a page like this.
Now, choose “Accounts and Import” and click the “Add another email address” button in the “Send mail as:” category.
A pop-up window will appear. I recommend putting either your real name or your screen name in the “Name:” box. It will be sent whenever you send emails in the form of Sender: Name <email@custom-domain>
. I’ll set mine to Shelf Business. Put the address you’ve been working with over the past few steps in the “Email address:” box. Click “Next Step”
On the next page, you’ll configure the SMTP server. Set the “SMTP Server:” box to smtp.mailgun.org
and “Port:” to 587
. Your username is your FULL email address, so in my case, business@shelf.pw. Paste the password you copied from earlier into the “Password:” box.
Now, Gmail will send a confirmation code to the address to make sure you’re the owner of it. Go back to your inbox and click on the new email from Gmail Team, then follow the directions. In my case, I have to click a link and I’m taken to this window.
After confirming, everything should be good to go!
Testing
At this point, everything should be set up correctly. It’s time to test the email to make sure it worked okay. I’ll go back to the Gmail inbox and compose a new email.
To test to make sure I can receive emails okay, I’m going to use my default Gmail address, set the recipient to business@shelf.pw
, and put some random stuff in the email. After pressing send, it should appear in my inbox.
To test sending, I’ll compose a new email and, in the “From” dropdown, I’ll choose the new address. In “To”, I’ll put my Gmail address, and again, fill it with something random to make sure the email works okay.
Final Thoughts
I did my best to explain everything with as much detail as possible so any attempts to replicate this procedure could go flawlessly. If you, the reader, encounter any issues with my procedure or have questions, please feel free to message me on Twitter or shoot me an email. I’ll get back to you as soon as I can.