If you host your own mail server (I do!), then you probably want your emails to actually reach their destination. A good first step in increasing the chances of your emails being delivered is enabling SPF.
SPF is actually the easiest thing to configure in a series of steps that you can take. I’ll soon publish tutorials on DKIM and DMARC – those require a more involved setup.
What you’ll need:
- Self-hosted mail server (Postfix on a machine).
- DNS access (ex: Cloudflare).
- Know your server IP.
- ~ 5 minutes of your time.
First, login to wherever your DNS can be configured. For this short tutorial, I’ll be assuming that you’re using Cloudflare. Adapt as necessary.[ifpaid 5 USD]
Now select “TXT” in the dropdown to the left. Write
@in the “Name” field and the following in the “Click to configure” box:
v=spf1 ip4:xxx.xxx.xxx.xxx mx a ~all
Where ip4 contains your mail server IP (this is optional if the ip is defined in an mx or a tag) and the mx and a entries tell SPF to allow any IP defined in MX or A entries. ~all tells SPF to SOFTFAIL if the sender IP does not match any of the conditions stated earlier. You can use -all instead to REJECT (this is stricter) emails from foreign IPs. A ?all setting allows you to ignore SPF while you test it.
We can now check our emails from GMail (click the three dot dropdown on an email you sent and click “Show original”).
As you can see, SPF shows a PASS – that means you’re done! Your emails should now have a better chance of arriving in Inboxes instead of the Spam/Junk box!