Source of: /ADI/email/contact_action_.php

<?php

  $secret
= "6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe";
  
 
$name  = $_POST[name];
 
$email    = $_POST[email];
 
$message    = $_POST[message];
 
$captcha = $_POST[captcha];

 
//Verifying the user's response

  
  
  
$url = 'https://www.google.com/recaptcha/api/siteverify';
  
$data = array('secret' => $secret, 'response' => $captcha);
      
$options = array(
          
'http' => array(
          
'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
          
'method'  => 'POST',
          
'content' => http_build_query($data),
       )
   );

$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);


  
$json = json_decode($response, true);
  

 
 if (
$json['success']) { 
 
 
// Send a confirmation message to the person.
 
$message = "Hello $name

We have received your message:

$message

Thank you for your contact,
you shall hear from us shortly!

- Figo
"
;

 
mail($email,"Your contact",
      
$message, "From:Figo <figo@deei.fct.ualg.pt>");
 
 
$report="Dear $name, Thank you for your contact!";
  include(
'message_template.html');

} else {
  
// Your code here to handle a failed verification
  
$report="Whoops, message failed, try again.";
   include(
'message_template.html');
  }
 
?>