Jump to content

Recommended Posts

Hi all,

 

I'm trying to set up an email processor for a contact form to use captcha (from http://recaptcha.net/plugins/php/).  When I implement this into my email processor however and test it.  The processor says the email was sent but no email shows up in the inbox.  Am I doing something incorrectly?

 

I believe I have all installed proplerly (the following is the form snippet):

 

<form action="scripts/contact_processor.php" method="post" class="horizontal" > 
    <div id="formleft">  
  <label for="name">Name:</label>
  <br />
<input type="text" name="name" id="name">
  <br />
  <label for="phone">Contact Number:</label>
  <br />
  <input type="text" name="phone" id="phone">
  <br />
  <label for="email">Email:</label>
  <br />
  <input type="text" name="email" id="email">
  <br />
  <label for="comments">Comments:</label>
  <br />
  <textarea name="comments" cols="" rows="3"></textarea>
  <br />
</div>
<div id="formright">
<?php
require_once('captcha/recaptchalib.php');
$publickey = "key inserted here"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
</div>
<div id="formsubmit">
<input type="submit" id="submit" value="Submit" />
<input type="reset" name="reset" id="reset" value="Reset" />
</div>
<div style="clear: both"></div>
<br />


  </form>

 

and the following is my php email processor:

 

<?php
//captcha
require_once('../captcha/recaptchalib.php');
$privatekey = "this is my key";
$resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
  die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
       "(reCAPTCHA said: " . $resp->error . ")");
}
//end captcha

$yourEmail = "[email protected]";
//The Email Address Form Results Will Be Sent To. Change to your email.

$subject = "Contacting Walker Industries";
//This will be displayed in your Email Subject line. Edit as needed.

$body = "Contact Information \n";
$body .= "Name: {$_POST['name']} \n";
$body .= "Phone: {$_POST['phone']} \n";
$body .= "Email Address: {$_POST['email']} \n";
$body .= "Comments: {$_POST['comments']} \n";

mail($yourEmail, $subject, $body, "From: {$_POST['name']} < {$_POST['email']} >");

$thankyousubject = "Your Information Was Submitted Successfully.";
//This will be displayed after a submission. Edit to suit your needs. The \n represent page breaks.

$thankyoumsg = "Thank you {$_POST['name']} for showing interest in Walker Industries Inc. We have recieved your information. We will reply shortly.";
//This will be displayed after a submission. Edit to suit your needs.

?>

<html>

<body style="background-color:#000000;color:#FFFFFF">
<center>
<b><?php echo $thankyousubject; ?></b>
<br /><br />
<?php echo $thankyoumsg; ?>
<br /><br /><br /><br />
<a HREF="http://www.walkerindustriesinc.ca" TARGET="_top">
<IMG SRC="http://www.walkerindustriesinc.ca/images/formbanner.png" WIDTH="600" HEIGHT="100" ALT="Return to Walker Industries" BORDER="0">
</a>
</center>
</body>
</html>

 

 

Link to comment
https://forums.phpfreaks.com/topic/188919-help-with-re-captcha/
Share on other sites

Have you configured PHP to use an SMTP server for sending emails yet? Where are you running this code from?

 

I am positive I had this working before... but then I removed it to try something different.

 

I'm trying to run it from this test page: www.walkerindustriesinc.ca/contact.php

Link to comment
https://forums.phpfreaks.com/topic/188919-help-with-re-captcha/#findComment-997547
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.