<?php
	$mail_to = 'sumeethkevin@gmail.com'; // specify your email here

	// Assigning data from $_POST array to variables
        $subjec = $_POST['sender_subject'];
	    $name = $_POST['sender_name'];
	    $mail_from = $_POST['sender_email'];
        $address = $_POST['sender_address'];
        $state = $_POST['sender_state'];
        $city = $_POST['sender_city'];
        $zip = $_POST['sender_zip'];
	    $phone = $_POST['sender_phone'];
        $message = $_POST['sender_message'];
	    $time = $_POST['radio_group_1'];
	    $way = $_POST['dropdown'];
	
	// Construct subject of the email
	$subject = 'sumeeth.tk-Message from visitor ' . $name;

	// Construct email body
        $body_message = 'Country: ' . $subjec . "\r\n";
	    $body_message .= 'From: ' . $name . "\r\n";
	    $body_message .= 'E-mail: ' . $mail_from . "\r\n";
        $body_message .= 'Address: ' . $address . "\r\n";
        $body_message .= 'State: ' . $state . "\r\n";
        $body_message .= 'City: ' . $city . "\r\n";
        $body_message .= 'Zip: ' . $zip . "\r\n";
		$body_message .= 'Home Phone: ' . $phone . "\r\n";
	    $body_message .= 'Message: ' . $message . "\r\n";
	    $body_message .= 'Time to contact: ' . $time .  "\r\n";
	    $body_message .= 'Way to contact: ' . $way . "\r\n";

	// Construct headers of the message
	$headers = 'From: ' . $mail_from . "\r\n";
	$headers .= 'Reply-To: ' . $mail_from . "\r\n";

	$mail_sent = mail($mail_to, $subject, $body_message, $headers);

	if ($mail_sent == true){ ?>
		<script language="javascript" type="text/javascript">
		alert('Thank you for the message. We will contact you shortly.');
		window.location = 'index.html';
		</script>
	<?php } else { ?>
    <script language="javascript" type="text/javascript">
        alert('Message not sent. Please, notify site administrator sumeethkevin@gmail.com');
        window.location = 'contact.html';
    </script>
	<?php
	}
?>