SPF, DKIM and DMARC for online stores: why order emails go to spam
Order confirmations, password resets and replies to your contact form are the emails customers expect within a minute. When they land in the spam folder, the customer thinks the order failed, writes to support or buys somewhere else. In most stores the cause is not the text of the email but three small DNS records that are missing or wrong: SPF, DKIM and DMARC.
What the three records do
- SPF is a list of the servers that are allowed to send email for your domain. If the sending server is not on the list, the message looks suspicious.
- DKIM is a digital signature added to each message. It shows that the message really comes from your domain and was not changed on the way.
- DMARC tells the receiving mail service what to do when SPF and DKIM checks fail (nothing, quarantine, reject) and sends you reports about who is sending mail as your domain.
Large mail services such as Gmail and Yahoo tightened their sender requirements in 2024, and mail that passes all three checks is treated better than mail that does not.
Check yours in five minutes
- Send a test email from your store to a Gmail address. Open the message, choose Show original (three dots menu) and look for the lines SPF, DKIM and DMARC. You want to see PASS three times.
- If something fails, look at the DNS records of your domain. Your developer can do it with three read-only commands:
dig +short TXT yourdomain.com
dig +short TXT _dmarc.yourdomain.com
dig +short TXT selector._domainkey.yourdomain.com
The first shows the SPF record (it starts with v=spf1), the second the DMARC record (v=DMARC1), the third the DKIM key. The selector name comes from your mail provider.
The most common mistakes
- Two SPF records. Only one is allowed; several make SPF fail.
- A sender missing from SPF: the newsletter tool, the helpdesk or the server that sends the shop’s mail.
- Too many lookups. SPF may trigger at most 10 DNS lookups; long lists of
include:entries go over the limit. - The shop sends with PHP
mail()from the hosting server, while SPF and DKIM were set up only for your mailbox provider. The mail says it comes from your domain, but the server that sends it is not authorised. - DMARC set to reject too early. Legitimate mail from a forgotten sender is then thrown away.
- A free address in the From field (for example a gmail.com address) while the mail is sent by your server.
A safe order of work
- List everything that sends email as your domain: the shop, the mailbox provider, the newsletter tool, the helpdesk.
- Publish one SPF record that covers all of them. Start with
~alland tighten later. - Turn on DKIM for each sender and add the keys they give you.
- Publish DMARC with
p=noneand a report address. Read the reports for two to four weeks. - When all legitimate mail passes, move DMARC to
p=quarantineand later top=reject. - Where possible, let the shop send through an authenticated SMTP account instead of PHP
mail().
Example records with placeholder values (yours will differ):
v=spf1 ip4:203.0.113.10 include:_spf.example-mail.com ~all
v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com
When to ask for help
If order emails still go to spam after this, or you are not sure which services send mail for your domain, I can check it. My email and domain package covers the checks, the records and a test of the real delivery, with a short written report.