Contact Form Processing Products - for all your needs

FormMail • Form Encryption • Hosted Forms

reCaptcha version 1

NOTE: this documentation is deprecated as it refers to the original version of reCaptcha. Please use reCaptcha version 2. Many of the links to external sites shown below now refer to instructions for the new version of reCaptcha, and cannot be used with the original version.

For an overview of why you might want to use reCaptcha or other CAPTCHA products, please view the How-To guide on stopping bots.

Built-In Support for reCaptcha

Using reCaptcha with Tectite FormMail is easier than using it with other form processors. This is because Tectite FormMail has built-in support for reCaptcha.

However, you still need to perform some steps to install reCaptcha and configure your HTML forms to use it.

The reCaptcha website provides instructions for setting it up with any PHP form processor.

For Tectite FormMail, you must skip the instructions for modifications/additions to the form processor.

Please follow the instructions below for installing reCaptcha with Tectite FormMail.

Note that unlike other CAPTCHA systems, reCaptcha does not use PHP sessions. This can make it easy to get working if your server is poorly configured and you have problems with PHP sessions.

Note: FormMail can use CAPTCHA to prevent incorrect or spam form submissions, as well as use it for auto responding. If you want to do both, make sure you read the section in the Autoresponding How-To guide.

Getting Started - First Step

Before you attempt to implement reCaptcha or any other spam protection, you must first get your HTML form working without these features.

This means you won't be confused by other unrelated errors or problems when you try to add in reCaptcha.

In particular, it's important that FormMail can alert you about errors. So, make sure you have set DEF_ALERT inside FormMail's configuration section and run the testalert test.

Second Step

Read how reCaptcha works.

Here's what you need to do:

  1. Signup on the reCaptcha website to obtain a public and private key.
  2. Download reCaptcha's library file (it's called "recaptchalib.php") and upload it to your server in the same directory/folder as your working copy of Tectite FormMail.

    Here's the link to download the library: reCaptcha library for PHP

    Note: when you upload "recaptchalib.php" to your server make sure it has permission mode rw-r--r-- (0644) so that PHP can load it into FormMail.

  3. Add the reCaptcha Challenge Widget. You need to decide where in your form you want to display the Captcha request (just before the Submit button is a good place). Click to view the detailed instructions and sample HTML code.

    In case Google change the URL unexpectedly (they do that sometimes!), we've replicated their code here:

    <script type="text/javascript"
        src="http://www.google.com/recaptcha/api/challenge?k=YOUR_PUBLIC_KEY">
    </script>
    <noscript>
    <iframe src="http://www.google.com/recaptcha/api/noscript?k=YOUR_PUBLIC_KEY"
        height="300" width="500" frameborder="0"></iframe>
    <textarea name="recaptcha_challenge_field" rows="3" cols="40">
    </textarea>
    <input type="hidden" name="recaptcha_response_field"
        value="manual_challenge">
    </noscript>

    Replace your_public_key with your reCaptcha Public Key.

  4. Reload your HTML form in your browser. It should now display a reCaptcha challenge.
  5. You must derive a field called "imgverify" from the reCaptcha field "recaptcha_response_field" so that FormMail receives the user's CAPTCHA input. Here's an example of this:
    <input type="hidden" name="derive_fields"
          value="imgverify=recaptcha_response_field" />
  6. Now proceed to the following steps on this page (below).

Third Step

Modify the configuration section of your copy of FormMail to include the Private Key you received from the reCaptcha website.

You need to set the RECAPTCHA_PRIVATE_KEY setting in FormMail. For example:

$RECAPTCHA_PRIVATE_KEY = "6Ld_5QkAXKAAAGyHeOrOIhJzF2tl4LHWx54iB-S2";

Fourth Step

From FormMail version 8.10, use the REQUIRE_CAPTCHA feature:

For FormMail prior to version 8.10, you must make the "imgverify" field required and implement an INI file to make the "required" specification secure.

$REQUIRE_CAPTCHA = "You must enter the image characters";

The Final Step

Test your form now:

  • enter the correct image string value
  • enter an incorrect image string value
  • enter no image string value

Using reCaptcha to Allow Auto Responding

FormMail's auto responding feature requires CAPTCHA to protect your server from becoming a spam gateway.

To use reCaptcha for this purpose, simply derive the field called "arverify" from "recaptcha_response_field" instead of "imgverify". (In the instructions above, replace "imgverify" with "arverify".

To enforce CAPTCHA for form submission and also enable auto responding, you simply do two derivations:

<input type="hidden" name="derive_fields"
  value="imgverify=recaptcha_response_field,
  arverify=recaptcha_response_field" />

or:

<input type="hidden" name="derive_fields"
  value="imgverify=recaptcha_response_field,
  arverify=imgverify" />