<?php

ini_set( display_errors, 1 );

    error_reporting( E_ALL );

$name = $_POST['name'];
$email = $_POST['email'];
//honey pot
//$title = $_POST['subject'];
//////////
$message = $_POST['message'];
$to = "contact@myguardcam.com";
$response = "";

//    echo $message;
$email=$_POST['email'];
$message=$name."\n\n".$message."\n\n".$email."\n\n";
//  echo $email;

$subject = $name." myGuardCam inquiry"; 
$from = "contact@myguardcam.com";

$headers = "From: " . $from;

//title is used as a honey pot, if the hidden field contains something msg it's not sent
/* if I want to use the honey pot
if (strlen($title) > 0) {
    
    $response = "message sent";

} else {
    $status = mail($to,$subject,$message,$headers);

    if($status) {
        $response = "OK";
    } else {
        $response = "NOT";
    } 
} */

$status = mail($to,$subject,$message,$headers);

    if($status) {
        $response = "OK";
    } else {
        $response = "NOT";
    }


//$response = "PHP Received: ".$name." ".$email." "."$message";
echo $response;
?>
