Many domain provider such as namecheap, godaddy, google offers free email forwarding services for their customer. But this is only applicable if you use their DNS. If you migrated DNS out to say CloudFlare then you have to setup email forwarding on your own.
Today we will setup email forwarding for a domain on cloudflare.com using a service call hanami It has a few other alternative email forwarding service, but one of reason we used CloudFlare is for privacy to hide our real IP Address. We should do the same with email as well. hanami is a premium email forwarding service that focus on privacy and great support.
Step 1. Get an account on hanami
Head to hanami.run and signed up for an account. The Individual plan allows you to add up to 5 domains which is pretty generous.
Step 2. Add your domain to hanami.run
After you signed up, hanami will immediately log you in. Then you will see a welcome screen that remind you to “Add your domain”, click on that button or go to this link directly
Fill in your domain and an email address to forward email to. All email that send to @mydomain.com will be forwarded to that email address. You can also add more alias or forward rules later on.
Then click “Save” and you’re done.
Step 3. Update your domain DNS in CloudFlare
Then in the next screen, hanami will ask you update your MX record to
mx1.hanami.run
mx2.hanami.run
Add add a TXT record on your domain with this value
v=spf1 include:spf.hanami.run ~all
So let’s head to CloudFlare dashboard and do it.
Step 3.1 Update MX record
In CloudFlare dashboard, go to your domain page. In this case, we will assume our domain is betterdev.link, click on button “+Add record” and fill in these information.
Then click “Save” and repeat this step for mx2.hanami.run but with a priority of 20
If you have any other existings MX record, make sure to delete them, only mx1.hanami.run and mx2.hanami.run should existed in your MX records to ensure email delivery.
Step 3.2 Add SPF record
Add another record, this time, set these params:
- type: TXT
- name: @
- Content: v=spf1 include:spf.hanami.run ~all
If you also have another existing SPF record, you can edit the SPF record like this v=spf1 include:spf.hanami.run include:_spf.google.com ~all
Step 4. Waiting for DNS propagate
Depend on your DNS TTL it may take a few mins to a few hours for DNS to be fully propagate and picked up by the internet. After that, hanami will say your DNS is ready and you create an alias or send some test email.
Note: if you use gmail, and send a test email to yourself, the email may not show up at all due to this: https://support.google.com/a/answer/1703601
Instead, use another email address or ask someone send you a test email, or even better, click on the “Test button” in hanami dashboard to have hanami send you a test email
and that’s it. You can start create alias like this
Happy email forwarding with hanami.