Prompt
spf dkim dmarc setup for app email
Latest observation
Here’s a practical setup guide for SPF, DKIM, and DMARC for app-sent email (transactional emails like signup, receipts, password resets).
1) Use a dedicated sending domain or subdomain
Best practice:
- Main domain:
example.com - App email subdomain:
mail.example.comorapp.example.com
This keeps your product email separate from normal company email and reduces deliverability risk.
2) SPF setup
SPF tells receiving servers which senders are allowed to send mail for your domain.
Example SPF record
If you send via a provider like SendGrid, Mailgun, Amazon SES, etc., your DNS TXT record might look like:
v=spf1 include:sendgrid.net ~all
Or for SES:
v=spf1 include:amazonses.com ~all
Notes
- Only one SPF record per domain.
- If you use multiple senders, combine them into one record.
- Keep it under the 10 DNS-lookup limit.
Example with multiple services
v=spf1 include:sendgrid.net include:amazonses.com ~all
3) DKIM setup
DKIM adds a cryptographic signature to outgoing email so receivers can verify it wasn’t altered.
How it works
Your email provider gives you:
- a selector
- a public key
- a DNS record to publish
Example DKIM record
Usually a TXT record like:
selector1._domainkey.example.com
v=DKIM1; k=rsa; p=PUBLIC_KEY_HERE
Notes
- Your provider will give the exact host/name and value.
- Most providers support 2048-bit keys. Use that if available.
- DKIM is usually enabled in your email provider dashboard after DNS is added.
4) DMARC setup
DMARC tells receivers what to do if SPF/DKIM fail, and gives you reporting.
Start with monitoring
Use a relaxed policy first:
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com; adkim=s; aspf=s
Or if you want relaxed alignment initially:
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
Common progression
p=none— monitor onlyp=quarantine— suspicious mail goes to spamp=reject— reject unauthenticated mail
Example stricter policy later:
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
Then eventually:
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
5) Recommended DNS records example
SPF
example.com TXT:
v=spf1 include:sendgrid.net ~all
DKIM
s1._domainkey.example.com TXT:
v=DKIM1; k=rsa; p=...
DMARC
_dmarc.example.com TXT:
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
6) Best practices for app email
- Use a dedicated subdomain for app email
- Make sure the From: address matches the authenticated domain
- Example:
no-reply@mail.example.com
- Example:
- Set up a real Reply-To if users need support
- Add a custom tracking domain if your provider supports it
- Use TLS for SMTP/API sending
- Warm up a new domain/IP gradually if volume is high
- Keep complaint/bounce rates low
7) Check alignment
For DMARC to pass:
- SPF or DKIM must pass
- The authenticated domain must align with the From domain
Example:
- From:
no-reply@mail.example.com - SPF/DKIM should authenticate
mail.example.comor aligned domain
8) Validate setup
Use tools like:
- MXToolbox
- Google Postmaster Tools
- Mail-Tester
- Your provider’s DNS checker
Send test emails to Gmail/Outlook and check:
- “Show original” in Gmail
- SPF: PASS
- DKIM: PASS
- DMARC: PASS
If you want, I can generate the exact SPF/DKIM/DMARC records for your provider (SendGrid, SES, Mailgun, Postmark, etc.) and your domain format.