Eddie's Blog

Thoughts, DIY, projects, Linux, IaC, and other things.

Custom Domain and Emails

What is this?

Let’s say you wanted to buy a domain like edfig.dev. You can host a personal blog at this address. Once you buy the domain, not only can you host content, but with a bit more tinkering you can send and receive emails with it.

You can email eddie@edfig.dev or admin@edfig.dev and that email will make its way to my inbox. You can set up rules to handle specific addresses too.

You’ll need to create accounts for the following:

Setting it up

1. The Domain

You can buy a domain from any registrar, I recommend PorkBun or Cloudflare. I’ll be using Porkbun for this discussion.

Pricing will depend on the name and what TLD (the .com part). I occasionally run into issues with sites not recognizing eddie@fig.systems as a valid email address because it’s a lesser known domain.

Once you have it you can enter DNS records to where you host stuff or start using it for email.

2. The Email

Email is one of those things you shouldn’t host yourself, it’s very annoying. But luckily there are services out there that take care of most of the hassle. MailGun and SendGrid are two such services. I’ll be using Mailgun here.

With Mailgun I can:

3. Setting up DNS

Pick your favorite. I’ll be using figgy.foo for this, there was a good deal on it.

You’ll be provided with records for sending, receiving, and tracking.

In Porkbun Domain Management select DNS when you hover over your new domain.

Copy the entries over. Make sure the Types match and that you leave off the figgy.foo portion in the host field in porkbun. Anything you add in the host field will automatically append your domain to the end of it. If the field is just figgy.foo then leave the host field blank.

Copy all the Value fields from Mailgun to the Answer field in Porkbun and then click on Verify at the top right. You should see the status change to Active.

This is what your records in porkbun should look like.

porkbun-email-dns-records

4. Setting up Mailgun

Routing emails.

Go to Send -> Receiving and Create a Route.

Expression Type -> Match Recipient

Enable Forward and fill in your personal address. For me that’d be my normal gmail address.

Set priority to 50 so you have space to add future routes before or after this route.

Add a simple description like “send to gmail” and Create the Route.

At the free tier you can only have 5 routes total. I only use the following:

Number 4 is where most of the magic and utility of setting all this up happens. I can give out unlimited custom email addresses and I’ll know who sent them by the address. That is, if I give out businessName@fig.systems I can later use that in gmail to filter, block, or search for anything related to that business. I can even see who sold my info if I start getting spam from that address.

⬅ Previous post
RSS - Still Alive

Next post ➡
RosterHash: fantasy football schedule viewer