Improve Email Deliverability From Debian
November 03, 2024
When you say that you want to host your own email, you’ll hear the standard line from folks: “Don’t do it. It’s too hard.” When they say “it’s too hard” what they mean is that it’s too hard to ensure that email you send will actually end up in other people’s inboxes.
If you persist, they’ll advise you to configure your email server with SPF, DKIM, and DMARC. Oh and also make sure the IP address of your email server isn’t on a blacklist.
After you complete these recommended incantations and start using your shiny new email server, you’ll notice that your email recipients on gmail don’t see your emails in their inbox. After reaching out, your recipients will tell you your email ended up in their gmail spam folder. So you start searching the internet for answers. “How do I keep my email from ending up in gmail spam folder?” The answers all pretty much point back to the incantations above. So to double check your setup you use a service like mxtoolbox and everything looks pretty good.
So now what? Do you give up on the distributed nature of SMTP and let Google/Apple/Microsoft oligopoly host your email like 90% of the internet? Be stubborn and resign yourself to the fact that you’ll need to utter the words “have you checked your spam folder” on a regular basis?
<sarcasm>I’m sure it’s shocking to folks that know me</sarcasm> that I’m squarely in the second camp: stubborn and stuck in spam folders.
Because I’m a counter-cultural rebel, I’m burying the click bait tag line here instead of in the title: Here’s one weird trick to improve email deliverability!
Hide your Received
headers. That’s it. Once I started doing that a
few days ago, my email started showing up in my buddy’s inbox instead of
his spam folder. It makes sense I suppose. Google looks for suspicious
IP addresses sending email so even though you’re relaying email through
a smarthost with a trusted IP address, your untrusted dynamic IP from
your home ISP is still visible in a Received header. So hiding those
headers leaks less information to Google that they can use against you.
Here’s how to hide Received headers if you’re using Exim on Debian as your email server:
me@myemailserver:~$ grep Received /etc/exim4/conf.d/main/000_localmacros
REMOTE_SMTP_TRANSPORTS_HEADERS_REMOVE = Received
Anyway, enjoy folks actually receiving your email!