Setup Email Form with captcha

These are steps and resources to set up an email form page with Google's reCAPTCHA
To see what you will get check out our email captcha demo.



NOTE: the check boxes have no function, they are there for your use as a checklist

1. Aquire reCAPTCHA Keys

If you don't already have one, set up a gmail account.

Signup for your keys at; reCAPTCHA.
You should be assigned two keys, a public and private, these will be used in your form HTML and processing PHP program.

2. Setup the email/recaptacha processing PHP program.

Download a copy of our PHP program, email_captcha.php . This program will check the users reCAPTCHA responce, validate the email form values and then send the email.
Open your copy of the email_captcha.php file in an editor. notepad ++ , is a good choice becuase it color highlights the code for HTML, CSS, PHP and many many others, and its free.
Add 'Send To' email address. In your program find the text string; "//@@@1".
Update the code: $email_to = "INSERT EMAIL ADDRESS HERE"; with the email address where you want the email sent to.
Add your private key. Find the text string; "//@@@2".
Update the code: "$privatekey = "PLACE YOUR PRIVATE KEY HERE";" with your private key.
Add email success HTML. Find the text string; "//@@@3".
Update the HTML as desired, or not.
FTP your file email_captcha.php to your web host server. Place it in the same folder that your email form HTML file is/will be located in.

3. Add reCAPTCHA's valadation PHP to your site.

The Google recaptcalib.php program handles the valadation of the reCAPTCHA challange and responce. It is called from your email_captcha.php program. These next step will download and add this program to your site's email form folder.
Download our copy of, recaptcalib.php
Or you may download and upzip the file from: Google's Latest
FTP file recaptcalib.php to your web host server. Place it in the same folder that your email form HTML file and email_captcha.php are located in.

4. Setup web page HTML

You will need to add two updates to your form's HTML or our sample form HTML.
Using our HTML form.
Download our copy of, email_captcha.html
Add your public key. Find the text string; "@@@". Replace the string; "@@@ PLACE YOUR PUBLIC KEY HERE" with your public key.

Using your HTML form.
Update your "<form>" tag. Add/update with; action="./email_captcha.php"
ie. <form name="contactform" method="post" action="./email_captcha.php">
Download reCAPTCHA Widget
Copy the Widget into your form between the "<form></form>" tags
Add your public key. Replace the string; "@@@ PLACE YOUR PUBLIC KEY HERE" with your public key.

FTP your email form HTLM to your web host server.

You now have a basic email form with reCAPTCHA. Give it a test.

5. Change the look of the reCAPTCHA box (optional)

You can change the look of the reCAPTCHA box from the standard red and tan theme to three other theme options.
To view the four theme choices look at this web page; Customizing the Look and Feel of reCAPTCHA
To change the theme of your reCAPTCHA.
Download the theme java script
Copy the java script into your email form after the "<form ....>" tag
Chose which theme you want (red, white, blackglass, clear) and enter it in the java script. ie. "theme : 'blackglass'"
FTP your email form HTLM to your web host server.

plexus designare is a division of ACME InterGalactic