The blog of Ross Fruen, a .NET consultant

reCAPTCHA and nms FormMail - part II

This post is the second in a series of posts describing the changes required to add reCAPTCHA to nmsFormMail.

With the changes outlined in part I in place a call to FormMail can be modified to use reCaptchas as follows...

Add a hidden field that specifies where nms should re-direct to if the CAPTCHA fails

<input name="captcha_fail_redirect" value="http://www.yousite.com/contact_captcha_fail.htm" type="hidden">

Add a javascript call to reCaptcha, replacing 'your_public_key' with your public key.

<script type="text/javascript"


And for those without javascript, again replacing 'your_public_key' with your public key...

<iframe src="http://www.google.com/recaptcha/api/noscript?k=your_public_key"
height="300" width="500" frameborder="0">

<textarea name="recaptcha_challenge_field" rows="3" cols="40">
<input type="hidden" name="recaptcha_response_field"



  1. Hi,

    Thank you for taking the time to provide this very useful Captcha solution!

    I have to admit I am having a little problem with following what needs to be done and would appreciate a little help.

    I have downloaded your Formmail Script in Part one, made the changes you highlight to personalise it to my domain, private key. and when I test the form it allows the form to be sent without checking the Captcha input data! I notice in Part 2 that you talk of adding more information, but to me it is not clear where this info. is expected to be placed? ...in my HTML/PHP file ? and if so where in the Head/Body? or is this further changes to the Formamil script itself?

    Basically would these extra changes in Part 2 solve my problem of verification of Captcha input?

    Any clarification would be much appreciated!

    Kind Regards,

    john R.

    - Written on 8th October 2014 by John R
  2. Hi John,

    In order to use the script outlined in Part One it is necessary to add the code fragments in Part II to the page where you are sending an email.

    In addition to get the reCaptcha form to display follow the instructions at https://developers.google.com/recaptcha.

    - Written on 8th October 2014 by Ross
  3. John, to add my own two cents I believe you'd add the javascript in the head section of your web page and the first "input" tag right after the beginning of your form start tag

    - Written on 18th December 2019 by Kenneth F LaVoie

Add a comment

If you want your comment to appear on this page please complete the form below. Your name and email address are optional, although the latter will be required if you want a response. Your email address will not appear against your comment and will only be used to correspond with yourself (where appropriate).


Thank you for submitting your comment, it will appear here after moderation is complete.


There was a problem sending your comment, please try again.