Fix form errors and stop contact form spam
Most broken contact forms fail for a handful of reasons: wrong action URL, a CORS preflight, missing name attributes, or emails filtered as spam. These guides go through each one, plus how to keep bots out.
Form backend returns a CORS error. How do I fix it?
A CORS error means the browser blocked your fetch() because the endpoint's response didn't include an Access-Control-Allow-Origin header for your site. Sending JSON (Content-Type: application/json) also triggers a preflight OPTIONS request the server must answer. Fix it by using an endpoint that answers CORS for your origin, or send FormData / URL-encoded data, which is a simple request with no preflight.
My contact form doesn't send. How do I debug it?
Open your browser's developer tools, go to the Network tab and submit the form. No request means the form isn't wired to anything; a 404 or 4xx means a wrong URL or missing fields; a CORS error is a cross-origin problem; and a 200 with no email usually means it went to spam or the endpoint was never confirmed. The table maps each symptom to its fix.
Why are my contact form emails going to spam?
Form notifications go to spam mostly when the email is sent "from" the visitor's address (which fails SPF/DKIM/DMARC checks), when the sending domain isn't authenticated, or when the message content itself is spammy. The fixes: send from an authenticated domain with Reply-To set to the visitor, mark the first message "Not spam", and add the sender to your contacts.
How do I stop spam on my contact form?
Stop most contact form spam with layers: a hidden honeypot field (bots fill it, people don't), filters for links and duplicates, per-IP rate limits, and a bot check such as Cloudflare Turnstile when bots get past those. An AI filter catches the human-written sales pitches that pass all of them.
Honeypot vs reCAPTCHA vs Turnstile vs hCaptcha: which should a contact form use?
Start with a honeypot: it's invisible and stops most simple bots. When spam gets through, add Cloudflare Turnstile (usually no puzzle) or hCaptcha. reCAPTCHA v3 is invisible too, but it's a Google service that scores visitors, which some sites avoid for privacy reasons. All three captcha-style checks must be verified on the server, never only in the browser.
Is it safe to put a form endpoint or access key in public HTML?
Yes, form endpoint URLs and public form keys (like Web3Forms' access_key) are designed to sit in your HTML: they can only deliver submissions to you, not send email to anyone else. What must never be in front-end code is a real email API key (Resend, SendGrid, SES), because that lets anyone send any email from your account.
Is a form backend GDPR compliant, and do I need a privacy policy for a contact form?
A contact form collects personal data (at least a name and email), so your privacy policy should say what the form collects, why, which service processes it and how long it's kept, and you should collect only what you need. Whether your setup meets GDPR depends on you and your provider's terms; check where the provider stores data and whether it offers a data processing agreement. This is general information, not legal advice.
Make your form email you
Paste one URL into your form and every submission is emailed to you, spam filtered. Free for 250 a month.
Get your endpoint