Contact Forms That Work: Design, Spam Protection and Email Delivery
The contact form is often the most important part of a small business website. It is where a visitor becomes a lead, a customer or a booking. It is also one of the most common sources of silent failure: forms that look fine but never deliver the message, forms buried in spam, and forms so long or confusing that people give up halfway. This guide covers how to design a contact form people actually finish, how to keep spam out without annoying real visitors, and how to make sure every message reaches your inbox.
Design: shorter is almost always better
Every extra field is another reason to leave. Ask only for what you need to reply.
- The minimum: name, email and message. For many businesses that is enough.
- Add fields only with a reason. A phone number if you really call back; a dropdown for the type of enquiry if it routes the message to the right person.
- Make optional fields clearly optional, or remove them.
- Use one column. Single-column forms are faster to scan and work better on phones.
- Write a specific button label. "Send message" or "Request a quote" is clearer than "Submit".
- Set expectations next to the form: how quickly you reply, and other ways to reach you, such as a phone number or email address for people who prefer them.
Build it properly
Good HTML makes a form easier for everyone, including people using screen readers and phones.
- Give every field a visible
<label>. Placeholder text disappears when people start typing and is not a substitute. - Use the right input types:
type="email"andtype="tel"show the right keyboard on phones and allow basic validation. - Add
autocompleteattributes (name,email,tel) so browsers can fill in the details. - Show errors next to the field, in plain words, and keep what the visitor already typed.
- After sending, show a clear confirmation on the page or a thank-you page. A thank-you page also makes conversions easy to track in analytics.
<form action="/contact" method="post">
<label for="name">Your name</label>
<input id="name" name="name" autocomplete="name" required>
<label for="email">Email</label>
<input id="email" name="email" type="email" autocomplete="email" required>
<label for="message">How can we help?</label>
<textarea id="message" name="message" rows="6" required></textarea>
<button type="submit">Send message</button>
</form>
More on labels, errors and keyboard access is in Web Accessibility Basics.
Where the form sends its data
The HTML only collects the data. Something on the server has to receive it and send it on. The main options:
- A CMS plugin. On WordPress, form plugins handle fields, validation, storage and email. The simplest choice for most sites.
- A form service. Hosted services receive the submission and email it to you, which suits static sites and site builders without a back end.
- Your own script. A short PHP or other server-side script gives full control, but you are responsible for validation, security and sending the email correctly. If you go this way, see PHP for Web Designers in 2026 and Common PHP Mistakes.
Whichever you choose, it is worth storing a copy of every submission in the database or the form service, not only in email. If an email goes missing, the message is still there.
Why form emails don't arrive
"The form says sent but I never get the email" is one of the oldest web support questions, and the cause is usually the same: the email is sent in a way that receiving mail servers do not trust.
- Sending with the server's basic mail function. PHP's
mail()and similar defaults send directly from the web server, often with no authentication. Gmail, Outlook and other providers increasingly reject or spam-folder these messages. - A "From" address the server isn't allowed to use. If the form sends "from" the visitor's Gmail address, your server is pretending to be Gmail, and the message fails authentication checks. Send from an address on your own domain and put the visitor's address in the Reply-To header instead.
- Missing SPF, DKIM and DMARC records. These DNS records tell receiving servers which services may send mail for your domain. Without them, form emails look like spoofing. Our guide to domains and DNS explains where these records live.
- The hosting provider blocks or limits outgoing mail. Many hosts restrict sending from shared servers to fight spam.
The reliable fix is to send form emails through authenticated SMTP or a transactional email service, using an address on your domain, with SPF, DKIM and DMARC set up for that service. On WordPress, an SMTP plugin connects the form to your mailbox provider or email service in a few minutes. Whether email and SMTP are included in a hosting plan, and what they cost after the first year, varies a lot between providers; our sister site payless.host explains how hosting plans are priced, including the extras that are easy to miss.
Stopping spam without punishing real people
Any public form will attract spam bots within days. Use several light layers rather than one heavy barrier.
- Honeypot field. Add a hidden field that real visitors never see or fill in. Bots fill in every field, so any submission with that field filled is rejected. Invisible to humans and surprisingly effective.
- Time check. Reject forms submitted within two or three seconds of the page loading. People cannot type that fast.
- Server-side validation. Check that the email address looks valid, the message isn't empty and fields aren't stuffed with links.
- Invisible challenge services. Tools such as Cloudflare Turnstile or reCAPTCHA v3 score visitors in the background and only challenge suspicious ones.
- Rate limiting. Limit how many submissions one IP address can send per hour.
Avoid old-style CAPTCHAs that ask people to read distorted text. They frustrate real visitors, block people with visual impairments, and modern bots solve many of them anyway.
Security basics
- Never trust form input. Validate and sanitise everything on the server, even if the browser already checked it.
- Prevent header injection. If your own script builds email headers from form fields, strip line breaks from them, or attackers can use your form to send spam to other people.
- Use prepared statements if you save submissions to a database. See SQL Injection: What It Is and How to Prevent It.
- Use HTTPS so form data is encrypted in transit.
- Collect only what you need and say in your privacy policy what you do with it. Under laws such as GDPR, a contact form collects personal data.
Test it regularly
Forms break quietly: a plugin update, a changed mailbox password or a DNS change can stop delivery without any visible error. Send a test message from the live site after every significant change, and at least once a month. Check that it arrives in the inbox, not the spam folder, and that replying goes to the visitor's address.
A contact form checklist
- Only the fields you need, in one column, with a clear button label.
- Visible labels, correct input types and autocomplete.
- Clear error messages and a confirmation after sending.
- Submissions stored as well as emailed.
- Email sent through authenticated SMTP from your own domain, with Reply-To set to the visitor.
- SPF, DKIM and DMARC records in place.
- Honeypot, time check and server-side validation against spam.
- HTTPS, sanitised input and a privacy note.
- Tested on the live site after every change.
Over to you: What's the strangest reason a contact form stopped working on a site you looked after? Share it in the comments below.
Related reading: WordPress Troubleshooting Checklist · Domains and DNS Explained · Web Accessibility Basics
Comments
Post a Comment
Share your experience, add a tip or ask a question. Comments are open to signed-in Google users. Please keep it helpful and on topic.