Email Headers, MX Records, SPF, DKIM & DMARC Explained
Understand how internet email actually routes from your app to an inbox—and why verification emails sometimes stall, bounce, or fail authentication.
Reliable verification email delivery depends on four DNS pillars: valid MX records on the receiving domain, SPF authorizing your sending IP, DKIM signing each message cryptographically, and DMARC aligning your From domain with SPF or DKIM.
How a verification email travels in under 5 seconds
When your web app triggers a signup OTP through Postmark, Amazon SES, SendGrid, or Resend, the sending server looks up the recipient domain’s DNS MX (Mail Exchanger) record, opens a TLS-encrypted SMTP session on port 25, and hands off the MIME message. Along the way, the receiving mail server evaluates three authentication checks—SPF, DKIM, and DMARC—to decide whether to accept, delay (greylist), or reject the message.
MX, SPF, DKIM, and DMARC at a glance
| Record | DNS Type | What It Verifies | Common Failure Symptom |
|---|---|---|---|
| MX | MX | Which mail server accepts email for a domain | Hard bounce (550 No route / NXDOMAIN) |
| SPF | TXT | Whether the sending IP is authorized for the MAIL FROM domain | Softfail/spam folder or 550 SPF fail |
| DKIM | TXT (selector) | Cryptographic signature proving headers & body weren’t altered | Broken signature after forwarding or bad selector key |
| DMARC | TXT (_dmarc) | Policy (none/quarantine/reject) + alignment with visible From: | Silent drop or rejection by Gmail/Microsoft/Yahoo |
Quick CLI commands to verify DNS records
Before blaming a recipient inbox when a test verification email fails to arrive, check your sending domain’s DNS records with dig:
# 1. Check recipient MX records
dig +short MX example.com
# 2. Check your sender SPF record
dig +short TXT yourdomain.com | grep v=spf1
# 3. Check your DMARC policy
dig +short TXT _dmarc.yourdomain.com
Reading Received: headers from bottom to top
Every SMTP hop prepends a new Received: header to the top of the email. To trace where a 45-second OTP delay actually occurred, always read Received: lines from the bottom (originating app/ESP) upward to the top (final receiving MX) and compare timestamps between adjacent hops. If the gap happens before your ESP hands the mail out, your app queue—not the recipient mailbox—is the bottleneck.
Frequently asked questions
Why do verification emails sometimes arrive 30–60 seconds late?
Delay usually comes from ESP outbound queues, TLS/DNS lookup retries, or receiving-server greylisting on first contact from a new sending IP.
Do I need both SPF and DKIM for reliable OTP delivery?
Yes. Major inbox providers require SPF and DKIM authentication plus a published DMARC record for bulk and transactional senders to avoid throttling or rejection.
How can I test my app’s transactional emails safely before launch?
Send staging verification emails to a fresh EduMails inbox (via web UI or api.edu-mails.com/api) to inspect subject lines, OTP formatting, and arrival timing end to end.
Need a free receive-only inbox now?
Generate a temporary .edu.pl or .org address on EduMails in one click, lock it with an optional password, or automate tests with our free public REST API.