File "mailer2.php"
Full Path: /home/u232077508/domains/24hremovals.co.uk/public_html/mailer/old/mailer2.php
File size: 4.32 KB
MIME-type: text/x-php
Charset: utf-8
<?php
session_start();
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
// echo '<h2>Please check the the captcha form.</h2>';
header("location:contact.php?err=captcha");
exit;
}
//$secretKey = "6Lf78x4TAAAAAMvJbVmnpIL4cAc_hPXnqulieY28";
$secretKey = "6Lch4ycTAAAAAAG-dou59Rmmq7cb8waq68_TVbwX";
$ip = $_SERVER['REMOTE_ADDR'];
$url = "https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha; // ."&remoteip=".rawurlencode($ip);
// echo $url;
$response=file_get_contents($url);
$responseKeys = json_decode($response,true);
//print_r($responseKeys);
if(intval($responseKeys["success"]) != "true") {
echo '<h2>Error !</h2>';
} else {
$name = $_POST['names'];
$tel = $_POST['tele'];
$mail = $_POST['email'];
$cservice = $_POST['service'];
$message = $_POST['comments'];
//Will set flag value to 1 when any field is not filled
if ( $flag !=1 ) {
/*Preparing contents for sending message.*/
$sitename = "test form";
$to = "varsi@ohboy.in, ratheesh@excellone.co.uk";
$subject = "Enquiry from $sitename" ;
$message = '
<table border="0" cellspacing="0" cellpadding="0" width="600" align="center">
<tbody>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="580" align="center">
<tbody>
<tr>
<td valign="top"><a href="" target="_blank"></td>
</tr>
<tr>
<td valign="top"><table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td valign="top"><table cellspacing="0" cellpadding="10" width="100%">
<tbody>
<tr>
<td colspan="2" valign="top"><p><strong></strong></p>
<h1> Enquiry from Keith Archers Tree Care Specialists</h1>
</td>
</tr>
<tr>
<td valign="top" width="31%"><p><strong>Your Name :</strong></p> </td>
<td valign="top" width="69%"> <p> <strong>'. $name.' </strong> </p> </td>
</tr>
<tr>
<td valign="top" width="31%"><p><strong>Telephone Number :</strong></p> </td>
<td valign="top" width="69%"><p> <strong>'. $tel.' </strong></p> </td>
</tr>
<tr>
<td valign="top" width="31%"><p><strong>Email :</strong></p> </td>
<td valign="top" width="69%"> <p><strong> '. $mail .' </strong></p> </td>
</tr>
<tr>
<td valign="top" width="31%"><p><strong>Service required :</strong></p> </td>
<td valign="top" width="69%"> <p> <strong> '. $cservice.' </strong> </p> </td>
</tr>
<tr>
<td valign="top" width="31%"><p><strong>Message :</strong></p> </td>
<td valign="top" width="69%"> <p> <strong> '. $message.' </strong> </p> </td>
</tr>
<tr>
<td colspan="2" valign="top" width="31%">
<p> </p>
</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
';
/*From address taken from form.*/
//$from = $mail;
$from = "enquiry@24hremovals.co.uk";
/* To send HTML mail, you can set the Content-type header. */
$headers1 = "MIME-Version: 1.0\r\n";
$headers1 .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers1 .= "To: ".$to."\r\n";
$headers1 .= "From: ".$from."\r\n";
$headers1 .= "Reply-To: ".$from."\r\n";
mail($to, $subject, $message, $headers1);
// echo $message;
header("location:thanks.php?sent=success");
}
}
?>