
<?php
error_reporting(0);
ini_set('display_errors', 0);

$field_name = $_POST['name'];
$field_email = $_POST['email_id'];
$field_phone = $_POST['subject-id'];
$field_message = $_POST['message'];

$mail_to = 'jatiharidwar@gmail.com';
$subject = 'Message from DBN Corridor site visitor '.$field_name;

$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'E-phone: '.$field_phone."\n";
$body_message .= 'Message: '.$field_message;

$headers = "From: webmaster@".$_SERVER["SERVER_NAME"]."\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";

// Send

ini_set("sendmail_from","webmaster@".$_SERVER["SERVER_NAME"]);

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

if ($mail_status) { ?>
	<script language="javascript" type="text/javascript">
		alert('Thank you for the message. We will contact you soon.');
		window.location = 'index.php';
	</script>
<?php
}
else { ?>
	<script language="javascript" type="text/javascript">
		alert('Message failed. Please, send an email to jatiharidwar@gmail.com');
		window.location = 'index.php';
	</script>
<?php
}
?>