// DevOps
Email Deliverability for Developers: SPF, DKIM, DMARC and Beyond
What we learned running our own SMTP server: SPF, DKIM and DMARC, reverse DNS, IP warm-up and keeping a sender reputation healthy.
Md Nayeem HossainSep 14, 20264 min read// DevOps
What we learned running our own SMTP server: SPF, DKIM and DMARC, reverse DNS, IP warm-up and keeping a sender reputation healthy.
Md Nayeem HossainSep 14, 20264 min readWhen we built our own SMTP server to send transactional and campaign email without per-message fees, the server itself was the easy part. Getting Gmail and Outlook to actually put those emails in the inbox — not the spam folder — was the real project.
Sending email is trivial. Being trusted as a sender is not. This post covers what developers need to know.
Mailbox providers decide where a message goes based on two questions: can they prove who sent it, and does this sender have a good reputation? Authentication answers the first. Your sending behavior answers the second. Since early 2024, Gmail and Yahoo require proper authentication for bulk senders, so this is no longer optional.
Sender Policy Framework is a DNS record listing the servers allowed to send mail for your domain:
1example.com. TXT "v=spf1 ip4:203.0.113.25 include:_spf.google.com -all"ip4: authorizes your own sending server.include: authorizes a provider you also send through.-all tells receivers to reject anything else.Watch the 10-DNS-lookup limit. Every include can trigger nested lookups, and exceeding the limit makes SPF fail entirely.
DomainKeys Identified Mail signs each outgoing message with a private key. The public key is published in DNS, and receivers verify that the signature matches:
1s1._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOC..."Use 2048-bit keys, keep the private key secure on the sending server, and rotate keys periodically using selectors (s1, s2) so you can switch without downtime.
SPF and DKIM prove things about servers and signatures, but not necessarily about the address the user sees in the From: header. DMARC requires alignment: the domain that passed SPF or DKIM must match the visible From domain. It also tells receivers what to do when checks fail, and sends you reports.
1_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:dmarc@example.com; adkim=s; aspf=s"Roll it out gradually:
p=none and collect aggregate reports for a few weeks.p=quarantine, then p=reject once reports are clean.A p=reject policy also stops attackers from spoofing your domain in phishing emails.
If you run your own SMTP server, a few more things must be right:
Authentication gets you considered. Reputation gets you delivered.
List-Unsubscribe header. Users who cannot unsubscribe click "Report spam" instead, which is far more damaging.Authentication and reputation dominate, but content can tip the balance:
Inbox placement depends on proving who you are and behaving like a trustworthy sender. Publish SPF, sign with DKIM, enforce DMARC gradually, configure reverse DNS and TLS on your own server, warm up new infrastructure, separate transactional from marketing mail and keep lists clean. Get these right and your emails land where you intended — in the inbox.