Guide · 2026-11-01 · By DNT
When a website's e-mail vanishes without a sound
The server says the mail was sent. The customer never gets it. How SPF, DKIM and DMARC fit together, and how to check your own domain.
The background is a map of DNT's six areas and the connections between them. Digital Products is connected to Software & AI. Software & AI is connected to Digital Products, Connected Systems, Automation & CTS and R&D. Connected Systems is connected to Software & AI, Automation & CTS and Hardware & Machines. Automation & CTS is connected to Software & AI, Connected Systems and Hardware & Machines. Hardware & Machines is connected to Connected Systems, Automation & CTS and R&D. R&D is connected to Software & AI and Hardware & Machines. This page belongs to Digital Products and Software & AI.
- Software
- Engineering
- Security
A message sent through a contact form is often the first thing a company hears from a new customer. That is why one of the most expensive faults a website can have is the one that looks like nothing at all: the form says thank you, the message is saved, the server reports the mail as sent, and nobody receives anything.
We met it ourselves on this site. The form worked, the server reported both mails as delivered to it, and nothing came through - not even to the spam folder.
What the server means by "sent"
When a PHP script calls the function mail(), it hands the message to a small program on the web server. The answer "sent" means only that this program took it. It says nothing about what happens next. A website can therefore be sure of its success while every message it sends is turned away further down the line.
Three checks at the receiver
The receiving mail server cannot see whether a mail from your address really is from you. So it looks up your domain's public records:
- SPF is a list of the servers allowed to send for the domain.
- DKIM is a digital signature on the mail itself, added by a server that holds the domain's key.
- DMARC is the domain owner's instruction: what should the receiver do with a mail that does not pass? Nothing, put it in spam, or reject it.
DMARC asks for more than a pass. The domain that passed must also match the one in the From field.
Why websites are hit in particular
Mail sent straight from a script on a web server easily ends up with neither a valid signature nor a server the receiver will accept for the domain. If the domain's DMARC policy is "reject", which is the safe setting and the default at some hosts, the mail is refused outright. It lands in no spam folder, and no error appears on the site, because the refusal happens after the script has finished.
The rule is a good one: it stops strangers from sending mail in your name. It simply also stops your own website if it sends the wrong way.
How to send it properly
The answer is to let the website behave like an ordinary mail program: sign in to the mail provider's server with a real mailbox, over an encrypted connection. The provider then signs the mail for the domain, and the checks pass.
Three pieces of advice we would give anyone:
- Keep the mailbox password where it cannot be read in plain text, and never in a file the web server can hand out.
- Save the request first and send the mail second. A mail should never be the only place a customer's message exists.
- Let the site say out loud when a mail is refused, and test with an address outside your own domain. A mail from your domain to your domain proves less than you would think.
Technical view
Look up your domain's rules
All of it is in the domain's public DNS, readable by anyone:
- SPF: nslookup -type=TXT example.com
- DMARC: nslookup -type=TXT _dmarc.example.com
- DKIM: nslookup -type=TXT [selector]._domainkey.example.com - the selector is the name your mail provider uses, found in its guide.
Read the answer on a real mail
Send a mail from the website to an address at a large provider. In Gmail, "Show original" shows for each check whether it passed. This is the only test that counts: it shows what the receiver actually saw.
What it says when it is right
- SPF: PASS, for the domain in the From field.
- DKIM: PASS, with d= set to your own domain.
- DMARC: PASS.
References
- RFC 7208: Sender Policy Framework (SPF)
- RFC 6376: DomainKeys Identified Mail (DKIM)
- RFC 7489: Domain-based Message Authentication (DMARC)