Why the message from your contact form never arrives
Operations and securityThe form says “Thank you, your message has been sent.” There is nothing in the inbox.
8 min read
By Timo Wessels Published
The form says “Thank you, your message has been sent.” There is nothing in the mailbox.
Both are true at the same time, and that is the whole problem. The website handed the message over. What happened next, it never learned.
This article is for you if a client says they got in touch and never received an answer. That is no small thing. Every enquiry that vanishes is a job somebody else gets.
The most important points first:
- “Sent” only means: the website passed the message on. It knows nothing more.
- The most common mistake in a form: putting the visitor’s address in as the sender.
- Look in the spam folder first, before you change anything on the website.
What “sent” actually means
A website does not send emails itself. It hands over a message to something else that is supposed to send it.
The success message only says: the handover worked. It says nothing about whether the message left the house, whether the recipient accepted it, or whether it sits at the destination in a folder nobody looks at.
That is not carelessness in the form. At this point the website really learns nothing more. The answer comes seconds or hours later, somewhere else.
The chain has four stations
- The form hands over to the website.
- The website hands over to a sending route.
- The recipient’s server decides whether to accept the message.
- The mailbox decides which folder it goes in.
Any station can fail. None reports. This is how I structure the search.
Station two: the most common cause
Many systems send by default with the built-in sending function. In PHP, the language behind WordPress, it is called mail(). According to the PHP manual it hands the message to a program on the server that is set in the settings (sendmail_path). If no mail program runs there, nothing happens, and the website does not notice. The manual names further pitfalls: line breaks and header lines have to be right by hand, and some mail programs alter them.
Whoever sends this way sends under the identity of the server and not that of your domain. To the recipient it looks like mail from a sender who claims to speak for you.
That is why many programs use a sending library instead. PHPMailer is the best known: it has SMTP built in and sends without a local mail server. SMTP is the language mail programs use to talk to mail servers. PHPMailer supports login and encrypted connections.
The mistake almost every self-built form makes
This is where it gets concrete, and this point alone explains many cases.
A form asks for the visitor’s email address. The obvious step is to enter this address as the sender of the notification. Then you click “Reply” in the mailbox and write straight back.
That is convenient and technically wrong.
Your server then sends a message that claims to come from a foreign domain. The recipient’s server checks whether your server is entitled to do that. It is not, because the foreign domain knows nothing about it.
The procedure behind this is called DMARC. According to the standard (RFC 7489), the check passes only if one of the two approvals (SPF or DKIM) passes and the approving domain matches the visible sender domain. The standard calls this “identifier alignment”. If a foreign address is in the sender field, nothing matches, and the check fails although your own entries are fine.
The right way: your own address is the sender. The visitor’s address goes in the “Reply-To” field. The reply button works the same, and the check passes.
That is a setting and not a rebuild. It is wrong on an alarming number of forms.
Station three: entries at your domain
What happens next no longer depends on the website but on entries at your domain. They decide whether the sending server may speak for you and what should happen to a message when a check fails.
Google requires senders to secure their domain with these procedures and recommends always setting them up. That is a topic of its own with its own article. One sentence is enough here: a form can be technically flawless and still deliver nothing if these entries are missing or do not fit the sending route.
Station four: your own mailbox
The least spectacular case, and it happens often enough to check first.
Messages that always look the same, always come from the same sender and are never answered move into the spam folder after a while. Or a filter rule someone created years ago sorts them into a subfolder nobody looks at any more.
Look in the spam folder and check your filter rules before you change anything on the website.
Two proper sending routes
The first route: the website logs in to a real mail server and hands the message over there, with address, credentials and encrypted connection, just as a mail program does. The message then goes out under your domain’s identity, because it really comes from your mailbox. That is the obvious route. It is set up in a few minutes and solves most cases.
The second route: a sending service that specialises only in sending. The website hands over there through an interface (API). The price: for such a service to send under your domain you have to set entries at the domain. That is the more laborious part, and it is why many stay with the first route.
What the second route gives back: a log
A mail server alone does not tell you what became of a message. It accepts it, and then there is silence.
A sending service keeps books. Postmark, for example, offers an interface for bounces, meaning messages that were not delivered. It distinguishes, among others, hard bounces (the address is rejected permanently) and spam reports. Through webhooks, which are automatic messages to an address of your choice, you are told, instead of searching in an interface.
Particularly valuable is the message to an address that does not exist. The recipient rejects it hard, and the service writes it down. That closes a gap the form itself cannot close: when filling in, there is no way to establish whether a typed address exists. A typo looks like a valid entry. Only the attempt to reply brings it out, and without a log you never learn that either. Then you take it for a client who has stopped getting in touch.
How to narrow it down in twenty minutes
The order goes from cheapest to most laborious. It is my practice:
- Spam folder and filter rules. Two minutes, and it explains a share of all cases.
- Fill in the form from outside. Not logged in, not with your address, but the way a stranger would. Does anything arrive?
- Look at the header lines of the message that arrived. Most mailboxes have a view that shows the original. It says which server sent it and whether the checks passed. If it says “pass” three times, the sending is not the problem.
- Look in the form to see what is entered as the sender. If it is the visitor’s address, you have the cause.
- Check which sending route the website uses. If nothing is set, it uses the built-in function, and that is the most likely suspect.
What you can do
1. Put your own address as the sender and the visitor’s address in the “Reply-To” field. It costs nothing and fixes a whole failure case.
2. Switch from the built-in sending to a real mail server. The standard route, done in a few minutes.
3. Check that the entries at the domain fit the chosen sending route. A cleanly set-up domain can still fail if a new sending route was not entered there.
4. If enquiries are your business, take a sending service with a log. Not for the speed, but so you notice when something does not arrive.
5. Put a reminder in your calendar. A form that worked for a year can quietly stop working after a server move, a change of host or a change to the domain entries. Filling it in from outside once a quarter takes a minute.
The core
A contact form is not something you build in once and forget. It is the start of a chain whose other links lie outside the website.
And it is the only function of your website where a failure is completely silent. A broken page you see. A broken form says “Thank you”.
Sources
- PHP Manual, mail — the function hands over to the program set in
sendmail_path; notes on line breaks and header lines: php.net(external site: php.net) - PHPMailer, project page on GitHub — SMTP built in, sending without a local mail server, login and encrypted connections: github.com(external site: github.com)
- IETF, RFC 7489: DMARC — the check passes only if SPF or DKIM passes and the checked domain matches the domain in the visible From field (identifier alignment): rfc-editor.org(external site: rfc-editor.org)
- Google Workspace Help, Email sender guidelines — senders should secure their domain with SPF, DKIM and DMARC: support.google.com(external site: support.google.com)
- Postmark, Bounce API — bounces by type such as hard bounce and spam report, webhooks for delivery and bounces: postmarkapp.com(external site: postmarkapp.com)
- Own testing practice — the four stations, the order of narrowing down, own address as sender and visitor in the Reply-To field, the check from outside, reading the header lines, the quarterly repeat.