Update
3 June 2025: Migrated to iCloud custom domain email for simplicity
Saw a post from Antfu, about setting up his own domain for receiving emails. Yesterday, I’ve spend sometime to set up my domain email, and went further from there - using my own domain to both receive and sending emails.
Prerequisites:
- A email service provider (recommend Gmail)
- A email routing service (Cloudflare or 3rd party eamail forwarding services)
- A SMTP service provider (Resend)
Overview #
This set up is free of charge, with a limitation on numbers of email you can send with Resend’s free plan (I remember they have recently increased to 3000 emails per month, which is good enough for my usage). If you have more volume, I recommend you to subscribe to Google Workspace for simplicity and peace of mind.
I will briefly go through the role of each components in this setup:
- Email routing service forwards all inbound email sent to
you@yourdomain.com
to your Gmail. - SMTP service ito ensure the outbound email you send originate from
you@yourdomain.com
. - Lastly, the Gmail serves as the mailbox warehouse and UI for you to view and manage all the emails.
Email Routing #
In Antfu’s post, Forward Email is mentioned as a free and open-source option. But if you are using Cloudflare for your domain DNS, the good news is that Cloudflare has a native email routing support. To me, Cloudflare also has much more credibility, so why not?
If you are not using Cloudflare, there’s still a way. You can use 3rd party services like Forward Email and ImprovMX, however Forward Email is not friendly to newly registed domains (it will detect if your domain is newly registered and they will charge for new domains). Hence, I recommend ImprovMX, it is free for your first domain.
The setup process is simple, just go to the domain in Cloudflare, and look for Email Routing setting. Add the email you want to forward, i.e. hi@yourdomain.com
amd the destination to forward i.e. your gmail.
And you are done for email routing.
SMTP Server #
A SMTP server is basically a way for you to send email. While I was working on my previous project, I learn about Resend from Cali’s post. It provides free tier for startup companies, and is definitely good enough for personal use.
Let’s head over to the Resend dashboard now to create and get our API key:
- Go to the Resend official website
- Sign up or Log in
- Verify your domain
- Click on "Add an API Key"
It’s that simple! Let’s copy the API key - we’ll need it later when configuring Gmail.
Configure Gmail #
Gmail basically uses it’s own SMTP server to send your email, and now you need to tell it to use Resend’s SMTP server which is bind to your domain to send the emails.
To achieve this, you need to go to setting -> Accounts and Imports -> Send email as, and configure the SMTP Credentials as follows:
Host: smtp.resend.com
Port: 25, 465, 587, 2465, or 2587 (recommend to use 465)
Username: resend
Password: YOUR_API_KEY
There’s a checkbox "Treat as Alias", you can either check or uncheck it, as it works either wise.
Click on save and you are done.
And now, you can say hi to me at hi@bicheng.me!