SPF, DKIM & DMARC setup

Authenticate your sending domain with SPF, DKIM, and DMARC so Gmail, Outlook, and Apple Mail trust your app's sign-in links and receipts.

Why inbox providers block unauthenticated app mail

Standard email protocols were never built with identity checks. Without DNS authentication, any server on the internet can claim a message came from receipts@yourbrand.com, leaving mailbox providers unable to separate legitimate payment confirmations from phishing attempts.

Major providers including Gmail, Yahoo, and Outlook now enforce strict authentication policies. Messages lacking valid SPF, DKIM, and DMARC records are routinely routed to Spam, stripped of active links, or rejected outright during SMTP handshakes.

On ExaSpark's Free plan (100 emails/month), authentication emails such as verification links and password resets send automatically from ExaSpark's pre-authenticated default sender.

Upgrading to Starter (1 custom domain, 1,000 emails/month) or Pro (up to 3 custom domains, 10,000 emails/month) puts your own brand directly in the From header and protects deliverability as volume scales.

Choosing a sending subdomain vs your root domain

Decide which hostname your app will send from before copying DNS records. For almost every production business, a dedicated subdomain like mail.yourdomain.com beats sending automated app mail directly from your root domain.

FactorDedicated subdomain (`mail.yourdomain.com`)Root domain (`yourdomain.com`)
ReputationProtects everyday team email if automated bounces spikeBounce spikes can hurt everyday team email delivery
SPF safetyOwns a clean, standalone v=spf1 recordRisks colliding with Google Workspace or Microsoft 365 SPF
Brand trustDisplays your domain clearly (bookings@mail.studionorth.co)Shortest address (bookings@studionorth.co)
DMARCPasses relaxed alignment with _dmarc.yourdomain.comPasses both strict and relaxed alignment

Set Reply-To: hello@yourdomain.com on outgoing emails from bookings@mail.studionorth.co so customer replies still reach your main support inbox.

Anatomy of SPF, DKIM, and DMARC records

Think of email authentication as a three-lock check. Each DNS record answers a different trust question before your message reaches the inbox.

SPF: authorizing outbound servers

SPF (Sender Policy Framework) is a TXT record listing the exact mail servers permitted to send on behalf of your hostname. Receiving servers check the envelope sender domain against that list.

Two strict DNS rules trip up production setups:

  • One SPF record per hostname. Publishing two v=spf1 TXT records on the same hostname triggers a permanent PermError and fails both immediately.
  • Maximum 10 DNS lookups. Every include:, a, mx, or redirect counts toward a hard RFC ceiling of 10 lookups; exceeding it breaks SPF everywhere.

DKIM: cryptographic message signing

DKIM (DomainKeys Identified Mail) attaches an encrypted header signature using a private key managed on the sending mail server. You publish matching public keys in DNS under <selector>._domainkey.<your-sending-host> (typically two CNAME records enabling smooth key rotation).

Receiving servers fetch your public DKIM key from DNS to confirm the message was never altered in transit. Unlike SPF, DKIM signatures survive email forwarding intact.

DMARC: alignment and enforcement policy

DMARC (Domain-based Message Authentication, Reporting & Conformance) sits at _dmarc.yourdomain.com. It verifies alignment between the visible From: domain and SPF or DKIM, and tells inbox providers how to handle failures.

dns
; Example 1: Recommended dedicated sending subdomain (mail.studionorth.co)
; Copy the exact selectors and targets displayed in Cloud -> Email.

mail.studionorth.co.                TXT    "v=spf1 include:_spf.mail-provider.example ~all"
s1._domainkey.mail.studionorth.co.  CNAME  s1.domainkey.mail-provider.example.
s2._domainkey.mail.studionorth.co.  CNAME  s2.domainkey.mail-provider.example.
_dmarc.studionorth.co.              TXT    "v=DMARC1; p=none; rua=mailto:dmarc@studionorth.co; adkim=r; aspf=r; pct=100"

If you send directly from a root domain running Google Workspace or Microsoft 365, merge all authorized include: entries into a single v=spf1 record:

dns
; Example 2: One combined SPF record on a root domain (never two v=spf1 records)
studionorth.co.  TXT  "v=spf1 include:_spf.google.com include:_spf.mail-provider.example ~all"

Step-by-step DNS setup and verification

  1. Add your domain in Cloud → Email

    Open Cloud → Email, click Add sending domain, and enter your subdomain (such as mail.yourdomain.com).

  2. Watch how your registrar formats Host fields

    Cloudflare, Namecheap, and GoDaddy usually auto-append .yourdomain.com. Enter s1._domainkey.mail instead of duplicating the root domain twice.

  3. Disable HTTP proxying on email records

    On Cloudflare, set every DKIM CNAME to DNS only (grey cloud). Orange-cloud proxying breaks DKIM lookups immediately.

  4. Publish a starting DMARC record

    If _dmarc.yourdomain.com does not exist yet, publish v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com.

  5. Verify status and send live tests

    Wait 5–30 minutes for DNS propagation, click Verify, and send test emails to both Gmail and Outlook.

Inspecting live headers and tightening DMARC safely

Open your test email in Gmail, select Show original, and confirm spf=pass, dkim=pass, and dmarc=pass appear inside Authentication-Results:

http
Authentication-Results: mx.google.com;
       dkim=pass header.i=@mail.studionorth.co header.s=s1 header.b=a8F3cK1p;
       spf=pass (google.com: domain of bounces@mail.studionorth.co designates 203.0.113.42 as permitted sender);
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mail.studionorth.co

Once every legitimate sender on your domain passes consistently, tighten DMARC across three stages so you never accidentally block real mail.

StagePolicyDurationBehavior
1. Monitorp=none; pct=1002–4 weeksDelivers mail normally while sending XML reports to your rua mailbox
2. Quarantinep=quarantine; pct=25 then 1002–4 weeksRoutes unauthenticated or spoofed mail to recipient Spam
3. Enforcep=reject; pct=100OngoingRejects forged messages before inbox delivery
Starter prompt · App

Configure all production transactional emails to send from `Studio North <bookings@mail.studionorth.co>` with `Reply-To: hello@studionorth.co`. Include clean HTML and plain-text versions for sign-up links, booking receipts, and reminders, linking directly to `https://studionorth.co` without URL shorteners.

Troubleshooting common DNS authentication errors

SymptomMost likely root causeReliable fix
Pending after 1 hourHost duplicated root domain (mail.brand.com.brand.com)Enter only the subdomain prefix in your DNS Host column and re-verify
DKIM fails in GmailCloudflare orange proxy enabled on DKIM CNAMESwitch every DKIM CNAME to DNS only (grey cloud)
SPF shows `PermError`Two v=spf1 TXT records on one host, or >10 lookupsMerge into one v=spf1 record, or isolate app mail on mail.yourdomain.com
DMARC fails alignmentVisible From: domain differs from DKIM d= domainMatch your app's From: domain to the exact verified domain in Cloud → Email
Outlook marks mail JunkNew domain with image-only HTML or URL shortenersRamp gradually, include crisp plain text, and use direct domain links
Custom sender blockedFree plan (100/mo) sends auth mail only via default senderUpgrade to Starter (1,000/mo) or Pro (10,000/mo)

Next steps

Still have a question?Ask our team and other builders on Discord.

From the blog