Email Deliverability: SPF, DKIM, DMARC, and Transactional Email That Avoids Spam
Transactional email is often considered done when `send_email()` returns success. But success in the application only means the sender accepted the message. It does not guarantee inbox placement, spam avoidance, or timely user visibility.
For web applications, email deliverability is part of the product. Email verification, password reset, deposit invoices, security notifications, and transaction updates all depend on email that actually arrives. When email fails, users think the application is broken.
SPF: who is allowed to send for the domain
SPF is a DNS record that tells receiving servers which IP addresses or services may send email for a domain. If the application uses a mail server different from the main hosting provider, SPF must include that sender. Incorrect SPF makes email look suspicious.
Do not stack too many SPF includes without understanding DNS lookup limits. Overly complex records can fail evaluation. Keep configuration simple and document every authorized sender.
DKIM: a digital signature for email
DKIM signs email so receivers can verify that the content was not changed and that it was sent by the expected domain. For transactional email, DKIM is critical. Without DKIM, a new domain or sudden volume increase is easier to distrust.
DMARC: policy when SPF or DKIM fails
DMARC tells receivers what to do when authentication fails. Start with monitoring mode, then tighten the policy gradually. Do not jump to the strictest policy before confirming that every legitimate sender is configured correctly.
Reverse DNS and IP reputation
If you send from your own server, reverse DNS should match. Mailbox providers look at IP reputation, domain reputation, bounce history, and volume patterns. Sending a lot of email from a new IP without warmup can damage deliverability.
Email content matters too
Aggressive subjects, too many links, broken HTML, or unnecessary attachments can push email toward spam. For transactional email, use clear subjects, concise content, and relevant links. Avoid marketing language in password reset or verification emails.
Bounce and complaint handling
If an email hard bounces, do not keep sending to the same address. If users mark messages as spam, domain reputation suffers. Applications should record bounces, complaints, and delivery failures. For important email, show a fallback status in the dashboard when possible.
Email OTP and inbox testing
Many products use email OTP or magic links. When building these features, QA teams need to test whether subjects are correct, codes arrive, expiration works, and resend does not create duplicates. OTPZap supports verification and inbox workflows so testing can stay separate from personal email.
Deliverability checklist
- Make sure SPF includes every legitimate sender.
- Enable DKIM for the sending domain.
- Use DMARC monitoring before strict policies.
- Check reverse DNS if sending from your own server.
- Record bounces and complaints.
- Monitor important email such as password reset and verification.
Test email and OTP flows cleanly
Use OTPZap to separate verification and inbox testing from personal accounts.
Open OTPZap