-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathemail.php
executable file
·22 lines (19 loc) · 986 Bytes
/
email.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
if(isset($_POST['submit']) && !empty($_POST['submit'])):
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])):
//your site secret key
$secret = '6LegE5QUAAAAANNrfK1U2uPJSu-qdccjvGU9YM7t';
//get verify response data
$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):
$subject = $_REQUEST['subject']; // Subject of your email
$to = '[email protected]'; //Recipient's E-mail
$headers = 'MIME-Version: 1.0';
$headers .= "From: " . $_REQUEST['email']; // Sender's E-mail
$headers .= 'Content-type: text/html; charset=iso-8859-1';
$message .= 'Name: ' . $_REQUEST['name'];
$message .= $_REQUEST['message'];
// Transfer the value 'sent' to ajax function for showing success message.
echo 'sent';
?>