D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
lampp
/
htdocs
/
Filename :
appMail.php
back
Copy
<?php $result = ""; $captcha; if (isset($_POST["submit"])) { require 'mail/PHPMailerAutoload.php'; if(isset($_POST['g-recaptcha-response'])){ $captcha=$_POST['g-recaptcha-response']; } if(!$captcha){ echo "<script>alert('Please check the the captcha form.'); window.location='index.php'</script>"; exit; } $secretKey = "6Lfm4sIUAAAAADLwIWzDrRU9ZJdQ1FuchFzhwfWx"; $ip = $_SERVER['REMOTE_ADDR']; // post request to server $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha); $response = file_get_contents($url); $responseKeys = json_decode($response,true); // should return JSON with success as true // if($responseKeys["success"]) { // echo '<h2>Thanks for posting comment</h2>'; // } else { // echo '<h2>You are spammer ! Get the @$%K out</h2>'; // } $mail = new PHPMailer; $mail->Host='smtp.gmail.com'; $mail->Port=587; $mail->SMTPAuth= true; $mail->SMTPSecure='tls'; $mail->Username = 'cityorange40@gmail.com'; $mail->Password = '7219653706'; // enable for local disable for server $mail->IsSMTP(); //from where $mail->setFrom($_POST['email'],$_POST['name']); //receive email $mail->addAddress('orangecityhearingaid@gmail.com'); $mail->addReplyTo($_POST['email'],$_POST['name']); $mail->isHTML(true); $mail->Subject='Appointment Form of :'.$_POST['name']; $mail->Body='<h3>Name :'.$_POST['name'].'</h3><h4> Email: '.$_POST['email'].'<br> Phone number:'.$_POST['phone'].'<br> Age:'.$_POST['age'].'<br> Message: '.$_POST['message'].'</h4>'; if(!$mail->send() && $responseKeys["success"]){ echo "<script>alert('Something wrong!!! Please try again later.'); window.location='index.php'</script>"; }else{ echo "<script>window.location='thankyou.php'</script>"; } } ?>