How to Add Cloudflare Turnstile to IM Mail Form
Protecting your WordPress contact forms from spam submissions and automated bot activity is essential.
Cloudflare Turnstile is a verification service designed to prevent automated submissions while minimizing friction for visitors.
The WordPress plugin “IM Mail Form” includes built-in support for Cloudflare Turnstile, allowing you to configure it without installing an additional CAPTCHA plugin.
This guide walks you through creating verification keys in Cloudflare, adding them to IM Mail Form, and testing the verification process on your contact form.
1. What Is Cloudflare Turnstile?
Cloudflare Turnstile is a service that helps verify whether website visits and form submissions are made by humans rather than automated bots.
Unlike traditional CAPTCHAs that frequently require users to select images, Turnstile adjusts its verification method based on the visitor’s circumstances.
You can use Turnstile even if your website does not use Cloudflare for DNS or CDN services.
2. Before You Begin
To use Cloudflare Turnstile, you need a Cloudflare account. If you don’t already have one, you can create one for free on the Cloudflare website.
If you already have a Cloudflare account, there’s no need to register again.
Turnstile also works on WordPress sites that do not use Cloudflare’s DNS or CDN services.
3. Create a Turnstile Widget in Cloudflare
First, create a widget in Cloudflare to handle verification.
Step 1: Open the Turnstile Dashboard
Sign in to the Cloudflare Dashboard and open Turnstile.
Click “Add widget manually”.
Step 2: Configure the Widget
Configure the following settings:
| Setting | Example |
|---|---|
| Widget name | IM Mail Form |
| Hostnames | example.com |
| Widget Mode | Managed |
| Pre-clearance | Off |
For Hostnames, register the hostname of the website where your contact form will be displayed.
For example, if your form is located at https://example.com/contact/, register example.com.
If you are using a subdomain, make sure to specify the appropriate hostname for the site hosting the form.
We recommend using “Managed” for Widget Mode, which allows Cloudflare to determine the appropriate verification method based on the visitor’s circumstances.
Step 3: Get Your Site Key and Secret Key
After creating the widget, Cloudflare provides two keys.
Site Key
A public key used to initialize the Turnstile verification widget in the visitor’s browser.
Secret Key
A private key used by your server to verify the result when a form is submitted.
Make sure both keys come from the same Turnstile widget.
Never share your Secret Key with anyone.
4. Add the Verification Keys to IM Mail Form
Next, configure the keys in your WordPress admin dashboard.
Step 1: Open CAPTCHA Settings
In your WordPress admin dashboard, navigate to IM Mail Form → CAPTCHA Settings.
The Cloudflare Turnstile section contains the following settings:
- Site Key
- Secret Key
- Widget Theme
Step 2: Enter Your Keys
Enter the Site Key and Secret Key obtained from Cloudflare into their respective fields.
You can leave Widget Theme set to “Light”.
Once you’ve entered the keys, save your settings.
Important: Enter the actual Site Key generated by Cloudflare, not your email address or Cloudflare account name.
The Secret Key must also belong to the same widget as the Site Key.
5. Enable Turnstile on Your Contact Form
Registering the keys does not automatically change the CAPTCHA provider for individual forms.
You need to enable Turnstile separately for each form where you want to use it.
Step 1: Open the Form Editor
In the IM Mail Form section of your WordPress admin dashboard, open the form you want to configure.
Step 2: Select the CAPTCHA Provider
In the form editor’s “CAPTCHA” settings, select Cloudflare Turnstile from the following options:
- None
- Cloudflare Turnstile
- Google reCAPTCHA v2
- Google reCAPTCHA v3
After selecting it, click “Save” on the right side of the screen.
Cloudflare Turnstile is now configured for that form.
6. Test Your Form Submission
Once configuration is complete, test the form on your live website.
- Open the page where your contact form is published.
- Enter sample data into the Name, Email Address, Message, and other relevant fields.
- If your form uses a confirmation screen, click “Confirm”.
- Make sure Turnstile verification completes successfully.
- Click “Submit” to send the form.
- Confirm that the submission completion screen appears.
When a confirmation screen is enabled in IM Mail Form, Turnstile verification takes place during the final submission.
The Turnstile widget may appear differently depending on its configuration and the visitor’s circumstances. Users are not necessarily required to interact with a checkbox every time.
7. Troubleshooting Submission Problems
If your form stops accepting submissions after enabling Turnstile, check the following settings.
“Please complete the verification, then submit again.” Appears
This error appears when verification has not completed successfully.
It can occur not only when a visitor has not completed verification, but also when the widget fails to initialize properly and cannot generate a verification token.
Start by checking the following:
① Is Your Site Key Correct?
Verify that the Site Key saved in IM Mail Form matches the one provided in your Cloudflare Turnstile widget settings.
② Is Your Secret Key Correct?
Make sure you are using the Secret Key generated for the same widget as your Site Key.
③ Is Your Hostname Correct?
Check that the hostname configured in Cloudflare matches the website where your contact form is hosted.
④ Is Turnstile Selected for the Form?
IM Mail Form lets you configure CAPTCHA separately for each form. Check the CAPTCHA settings for the correct form and save your changes.
⑤ Is Verification Working in the Browser?
If required JavaScript files are blocked, the Turnstile widget may fail to initialize or complete verification.
Check whether browser extensions, ad blockers, or other browser settings are interfering with the verification process.
Submission Fails After Verification
Turnstile verification tokens have a limited lifetime.
Each token is valid for five minutes after it is issued and can only be verified once.
If a visitor waits too long on the confirmation screen, for example, they may need to complete verification again.
8. Summary
By combining Cloudflare Turnstile with IM Mail Form, you can add spam protection to your WordPress contact forms without installing an additional CAPTCHA plugin.
The setup process involves three main steps:
- Create a Turnstile widget in Cloudflare and obtain your Site Key and Secret Key.
- Enter the keys in IM Mail Form’s CAPTCHA Settings.
- Select Cloudflare Turnstile for the form you want to protect and save your changes.
After completing the setup, always test the published form to make sure verification and email delivery work correctly.
Try IM Mail Form
IM Mail Form is a WordPress contact form plugin that includes confirmation screens, email notifications, submission logs, and spam protection.
In addition to its free core features, optional add-ons are available for conditional logic, recipient routing, and webhook integrations.