Hello All,
I have been trying to get recaptcha to work on my clients website. I think I am very close from it working I am just not sure what I am missing. At the moment the form won’t send by email but it is saying the recaptha is verified.
here is the current code:-
[php]
<?php
// call the lib..
require_once('recaptchalib.php');
// Get a key from http://recaptcha.net/api/getkey
$publickey = "mypublickey";
$privatekey = "myprivatekey";
if ($_POST["submit"]) {
$response = recaptcha_check_answer($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($response->is_valid) {
$ToEmail = '[email protected]';
$EmailSubject = 'Site contact form ';
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["name"]." "; $MESSAGE_BODY .= "Email: ".$_POST["email"]." "; $MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])." "; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); echo "Yes, that was correct!"; } else { # set the error code so that we can display it echo "Eh, That wasn't right. Try Again."; } } ?>
|
I look forward to a response and thanks in advance sorry if this has been posted before please direct to example.
cheers Paul