<?php
	session_start();

	$name = $_POST['name'];
	$job = $_POST['job'];
	$email = $_POST['email'];
	$phone = $_POST['phone'];
	$subject = $_POST['subject'];
    $message = $_POST['message'];


	// the mail headers
	$headers = "From: ".$email. "\r\n";

	// the message
	$msg = "Name: ".$name."\n"."Job Enquiry: ".$job."\n"."Email: ".$email."\n"."Phone: ".$phone."\n"."Subject: ".$subject."\n"."Message: ".$message;
	// use wordwrap() if lines are longer than 70 characters
	$msg = wordwrap($msg,70);

	// send email
	$send_mail = mail("info@casamoderno.com.my",$subject,$msg,$headers);

	if($send_mail <> false)
	{
		$_SESSION["contact_status"] = "Thanks for your submission. We will get back to you soon.";
	}
	else
	{
		$_SESSION["contact_status"] = "Opps. Something went wrong. Please let us know via the others channel below.";
	}

	header("Location: http://casamoderno.com.my/contact.php#contact_form");

	exit();
?>