Paj Digital Labs
All articles
Hosting & Server Infrastructure

Email Deliverability Is Infrastructure: SPF, DKIM, DMARC and the PTR Nobody Set

Your application sends mail from a box with no reverse DNS and a SPF record that says ~all. Then everyone is surprised the invoice landed in spam. Deliverability is a DNS problem before it is a content problem.

Paj Digital Labs 3 min read
Server racks and network cabling in a data center
Editorial illustration · Hosting & Server Infrastructure

The ticket always reads the same way: "customers say they never got the email." The application logs show a clean 250 from the SMTP relay. The code is fine. The problem is that the internet does not trust your server, and it has been telling you so in DNS records you never looked at.

Deliverability is decided before your message body is ever read. Receiving servers score the sending infrastructure — IP reputation, reverse DNS, authentication records — and only then look at content. You cannot copywrite your way out of a missing PTR record.

The four records that decide your fate

| Record | What it proves | What breaks without it | | :--- | :--- | :--- | | PTR (reverse DNS) | The IP maps back to your hostname | Instant spam-folder on strict receivers | | SPF | Which servers may send for your domain | Anyone can spoof you; receivers distrust you | | DKIM | The message was signed by your domain and not altered | No cryptographic proof of origin | | DMARC | What receivers should do when SPF/DKIM fail | No policy, no reporting, no visibility |

PTR first, because nobody sets it

Forward DNS (A record) points a name at an IP. Reverse DNS points the IP back at a name. Receivers check that they agree — a "forward-confirmed reverse DNS" lookup. Your VPS provider controls the PTR, not your DNS host, which is why it gets forgotten: it lives in the hosting panel, not the zone file.

bash
dig -x 203.0.113.10 +short
class="text-code-comment"># mail.pajdigital.example  — good
class="text-code-comment"># 203-0-113-10.dynamic.provider.net  — you have a problem

Set the PTR to your mail hostname, and make sure that hostname's A record points back to the same IP. Both directions or it does not count.

SPF: one record, not five

SPF is a TXT record listing who may send for your domain. The classic mistake is accumulating records — one from the web host, one from the newsletter tool, one from the CRM — until the domain has three SPF records and all of them are invalid. You get exactly one.

text
v=spf1 mx include:_spf.google.com include:sendgrid.net -all

Two details matter. First, the include: mechanism costs DNS lookups, and SPF fails permanently after ten. Audit your includes; nested includes count too. Second, end with -all (hard fail) once you are confident, not ~all (soft fail) forever. Soft fail is a debugging posture, not a policy.

DKIM: sign it or it did not happen

DKIM adds a cryptographic signature to each message, verified against a public key you publish in DNS. Most relays generate the keypair for you and hand you a TXT record to paste. The failure mode here is rotation: keys from 2019 still in DNS, selectors nobody remembers, and a migration that silently broke signing three months ago.

bash
dig TXT selector1._domainkey.example.com +short

If that returns nothing and your relay thinks it is signing, every message you send is failing DKIM.

DMARC: the policy and the reports

DMARC ties it together: it tells receivers what to do when authentication fails and where to send aggregate reports. Start with monitoring, then tighten.

text
v=DMARC1; p=none; rua=mailto:dmarc@example.com; fo=1

Read the reports for a month. You will discover services sending as you that nobody documented — the old ticketing system, a forgotten cron on a decommissioned box. Fix or authorize each one, then move to p=quarantine, then p=reject. Skipping straight to reject is how you block your own invoicing system.

The boring truth

None of this is clever. It is four DNS records, a hosting panel setting, and a monthly habit of reading reports. But it is the difference between a server that sends mail and a server that sends mail people receive.

Paj Digital Labs

The engineering journal of Paj Digital Solutions — hosting, server infrastructure and web engineering, written by the people who run the servers.

Related reading