<?php
$field_name = $_POST['name'];
$field_email = $_POST['email'];

$field_msg = $_POST['message'];
$mail_to = 'vibhu2392@gmail.com';
$subject = $_POST['subject'];
$body_message = 'Name: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";

$body_message .= 'Message: '.$field_msg;

$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";

$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>

	<script language="javascript" type="text/javascript">
		alert('Thank you for enquirey. Have a nice day!');

		window.location = 'index.html';
	</script>
<?php
}
else { ?>
 
	<script language="javascript" type="text/javascript">
		alert('Please try again');

		window.location = 'index.html';
	</script>
<?php
}
?>