test

testing!
Name:
Email:
Phone Number:
Comments:
Name"; } if(empty($user_email)) { $empty[] = "Email"; } if(empty($user_phone)) { $empty[] = "Phone Number"; } if(empty($content)) { $empty[] = "Comments"; } if(!empty($empty)) { $output = json_encode(array('type'=>'error', 'text' => implode(", ",$empty) . ' Required!')); die($output); } if(!filter_var($user_email, FILTER_VALIDATE_EMAIL)){ //email validation $output = json_encode(array('type'=>'error', 'text' => ''.$user_email.' is an invalid Email, please correct it.')); die($output); } //reCAPTCHA validation if (isset($_POST['g-recaptcha-response'])) { require('component/recaptcha/src/autoload.php'); $recaptcha = new \ReCaptcha\ReCaptcha(SECRET_KEY); $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); if (!$resp->isSuccess()) { $output = json_encode(array('type'=>'error', 'text' => 'Captcha Validation Required!')); die($output); } } $toEmail = "member@testdomain.com"; $mailHeaders = "From: " . $user_name . "<" . $user_email . ">\r\n"; $mailBody = "User Name: " . $user_name . "\n"; $mailBody .= "User Email: " . $user_email . "\n"; $mailBody .= "Phone: " . $user_phone . "\n"; $mailBody .= "Content: " . $content . "\n"; if (mail($toEmail, "Contact Mail", $mailBody, $mailHeaders)) { $output = json_encode(array('type'=>'message', 'text' => 'Hi '.$user_name .', thank you for the comments. We will get back to you shortly.')); die($output); } else { $output = json_encode(array('type'=>'error', 'text' => 'Unable to send email, please contact'.SENDER_EMAIL)); die($output); } } ?>