Stop contact form spam without a captcha

5 min read

You can keep automated spam off a contact form without a captcha by combining three cheap checks: a hidden honeypot field that only bots fill in, a per-visitor rate limit, and an allowlist of the sites that may post to your form. Add a challenge such as Cloudflare Turnstile or reCAPTCHA v3 only when a form is being targeted and bots get past those. In SagePigeon all of it is on the Free plan, and every rejected submission is kept for a week so you can rescue a real one.

Start with a honeypot

A honeypot is a form field that people never see. Scripts that spam contact forms usually fill in every input they find, so they fill this one too and give themselves away. A real visitor leaves it empty.

Every SagePigeon form has one from the first submission. The field is called _gotcha unless you rename it, and it is already in the snippet on your form's Setup tab:

HTML
<input name="_gotcha" type="text" tabindex="-1" hidden autocomplete="off" />

Each attribute has a job. hidden keeps it off the screen and away from screen readers. tabindex="-1" keeps keyboard users from landing in it. autocomplete="off" stops a browser from filling it with a saved name.

When a submission arrives with the honeypot filled, SagePigeon answers with the same success response a real submission gets. The bot learns nothing and moves on. The submission goes to your Spam list, marked "Filled a hidden field", and no email or Slack message goes out.

You can rename the field under Settings → Validation and abuse → Honeypot field. If you do, change the snippet on your site at the same time, or the trap stops catching anything.

Rate limits

The second check is how often one visitor may post. SagePigeon's defaults are 20 submissions a minute and 200 an hour from one address, on each form. A person filling in a contact form never comes near that. A script hammering your endpoint hits it fast, and every post past the limit is refused with a 429 and rate_limited.

For a small contact form you can tighten it. Set Most a visitor may post a minute and And an hour under Validation and abuse; 3 a minute and 20 an hour is plenty for most contact forms. Leave the defaults alone on a form that many people submit from one office network, such as an internal sign-up sheet.

Allowed origins

By default any website can post to your endpoint. Once your form is live, list your own site under Allowed origins, for example https://example.com. Matches are exact, so add https://www.example.com as well if your site answers on both. A browser posting from any other site is refused with origin_not_allowed.

The allowlist stops someone else's web page from using your endpoint. It does not stop a script that posts from a server, because those requests carry no Origin header at all, and SagePigeon lets them through so that your own curl tests and server-side posts keep working. The honeypot and the rate limit handle scripts.

When to add a challenge

If spam still reaches your Inbox with those three in place, add a challenge. SagePigeon supports two, chosen under Validation and abuse → Spam challenge.

Cloudflare Turnstile

Turnstile gives a clear pass or fail and usually shows the visitor nothing at all. Add Cloudflare's widget inside your form; it puts a cf-turnstile-response token in the form when the visitor passes:

HTML
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>

<form action="https://api.example.com/f/FORM_ID" method="POST">
  <!-- your fields -->
  <div class="cf-turnstile" data-sitekey="YOUR_SITE_KEY"></div>
  <button>Send</button>
</form>

Then choose Cloudflare Turnstile in SagePigeon and paste your Turnstile secret. A submission without a valid token is refused with a 403 and captcha_failed, and kept in Spam as "Failed the captcha". If Cloudflare cannot be reached to check a token, the submission is refused too, so a real visitor may occasionally need to press Send again.

reCAPTCHA v3

reCAPTCHA v3 does not ask the visitor anything. It scores each visit from 0 (likely a bot) to 1 (likely a person). Add a hidden input named g-recaptcha-response to the form, and fill it with a fresh token as the visitor submits:

JavaScript
grecaptcha.ready(() => {
  grecaptcha.execute(SITE_KEY, { action: 'submit' }).then((token) => {
    form.querySelector('[name=g-recaptcha-response]').value = token
    form.submit()
  })
})

Choose reCAPTCHA v3, paste the reCAPTCHA v3 secret, and set Expected action to submit so a token minted on some other page is refused. The slider, Quarantine below score, starts at 0.5.

SagePigeon treats a low score differently from a failed token. A submission under your threshold is not refused. It is filed in Spam as "Scored low", and the visitor is told it went through. Real people on VPNs and privacy-focused browsers often score low, and refusing them outright loses enquiries you would never hear about. A missing or invalid token is still refused. And if Google's verification service cannot be reached, the submission is let through, so an outage on their side does not turn into a wall of errors on yours.

Our view: use Turnstile on forms where a false refusal costs little, such as a newsletter sign-up. Use reCAPTCHA v3 with the quarantine on forms where one lost enquiry is worth real money, such as quote requests.

Check what was caught

Everything the filters rejected is in Spam, kept for seven days, newest first, with the reason beside each one. "Scored low" is the pile worth reading; the other two are almost always bots.

If something real is in there, press Release. It is delivered as though it had arrived normally. The notification goes out, Slack gets its message, and the request joins the Inbox like any other. Spam does not count toward your monthly submissions, so a flood of bot posts will not use up the Free plan's 500.

The order we recommend

  1. Keep the honeypot from the snippet. It costs nothing.
  2. Add your site under Allowed origins as soon as the form is live.
  3. Tighten the rate limit on small contact forms.
  4. Look at Spam after a week. If real spam is getting into your Inbox, add Turnstile, or reCAPTCHA v3 for high-value forms.

The docs on spam controls list every field, and the static site guide covers the rest of the form.

Questions people ask

Does a honeypot field hurt accessibility?

Not when it is built like the snippet: hidden from view and from assistive technology with the hidden attribute, out of the tab order with tabindex="-1", and with autocomplete off so browsers do not fill it.

Do spam submissions count against my monthly allowance?

No. Submissions caught by the honeypot or a captcha are kept in the Spam list for seven days and are not counted toward your plan's submissions.

Is spam protection on the Free plan?

Yes. The honeypot, rate limits, allowed origins, Cloudflare Turnstile, reCAPTCHA v3 and the Spam list are on every plan.

Should I use Turnstile or reCAPTCHA v3?

Turnstile if you want a clear pass or fail. reCAPTCHA v3 if you would rather file doubtful submissions for review than refuse them, which suits forms where losing a real enquiry is expensive.

Protect a form for free.

Create a workspace, paste the snippet with its honeypot, and add your domain to the allowlist. No card needed.