<?php

/*
 * Script for sending E-Mail messages.
 * 
 * Note: Please edit $sendTo variable value to your email address and $subject variable value to desired subject for all E-Mails.
 * 
 */

$action = $_POST['action'];
if ($action == 'contact') {
    // you can change default Subject for contact form here
    $subject = 'Contact form message.';
}else if($action == 'comment'){
    // you can change default Subject for comment form here
    $subject = 'New comment!';    
}

$name = $_POST['form_data'][0]['Name'];
$email = $_POST['form_data'][0]['Email'];
$message = $_POST['form_data'][0]['Message'];
if ($name == "" || $email == "" || $message == "") {
    echo "There was problem while sending E-Mail. Please verify entered data and try again!";
    exit();
}

$email = $_POST['form_data'][0]['Email'];
$headers = 'From: ' . $email . "\r\n" .
        'Reply-To: ' . $email . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

// please change this to your E-Mail address
$sendTo = "mrkyvk@gmail.com";

if (mail($sendTo, $subject, $message, $headers)) {
    echo "Message sent succesfully.";
} else {
    echo "There was problem while sending E-Mail.";
}
?>
