Jump to content

bizstorm

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by bizstorm

  1. neither has failed as it proceed to thank you page, however on mail($email_from, $email_subject2, $email_message, $headers2); no mails received
  2. i did remove th @s . mail($email_to, $email_subject, $email_message, $headers); is working as the sent mail is received. mail($email_from, $email_subject2, $email_message, $headers2); this code is not executed. -
  3. No. It is not sending the copy to sender
  4. not sure where the mistake or error in code is
  5. I would like to send a copy of the mail contents to sender. The mail is sent to me but not the sender. Below is my code but not sure where the error in code is . Any help would be great Thanks <?php if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) if(empty($_POST[‘g-recaptcha-response’])){ $errMsg = 'Please check the robot checkbox.'; } else if(isset($_POST[‘g-recaptcha-response’]) && !empty($_POST[‘g-recaptcha-response’])) { $secret = 'secret code'; $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']); $responseData = json_decode($verifyResponse); if($responseData->success) { $succMsg = 'Your contact request have submitted successfully.'; } else { $errMsg = 'Robot verification failed, please try again.'; } } if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "[email protected]"; $email_subject = "Online Contact Form"; $email_subject2 = "Please find a copy of the contact form you submitted"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Last Name: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Telephone: ".clean_string($telephone)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". $headers2 = "From:" . $email_to; 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_from, $email_subject2, $email_message, $headers2); @mail($email_to, $email_subject, $email_message, $headers); header("Location: contact-thank-you.html"); ?> Thank you for contacting us. We will be in touch with you very soon. <?php } ?>
  6. Got it. I wish to thank you for the help 😂
  7. Noted Thanks, made the changes, working but not taking me to my thank you page
  8. Thanks will check now
  9. Hi Thanks for the response and any inconvenience, please find below <?php if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) if(empty($_POST[‘g-recaptcha-response’])){ $errMsg = ‘Please check the robot checkbox.’; } else if(isset($_POST[‘g-recaptcha-response’]) && !empty($_POST[‘g-recaptcha-response’])) { $secret = '6LcRNsUUAAAAAEap2oQ-wjTO2hmJoDC_OLlWoA29'; $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']); $responseData = json_decode($verifyResponse); if($responseData->success) { $succMsg = 'Your contact request have submitted successfully.'; } else { $errMsg = 'Robot verification failed, please try again.'; } } if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "[email protected]"; $email_subject = "Online Contact Form"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Last Name: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Telephone: ".clean_string($telephone)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> header("Location: contact-thank-you.html"); Thank you for contacting us. We will be in touch with you very soon. <?php } ?>
  10. Hi All. New at this, form is working perfect, then added recapthca, now it only handles recaptcha and not the form. not sure where the error is
×
×
  • 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.