<?php

$name=strip_tags($_POST[name]);
$company=strip_tags($_POST[company]);
$phone=strip_tags($_POST[phone]);
$mobile=strip_tags($_POST[mobile]);
$email=strip_tags($_POST[email]);
$address=strip_tags($_POST[address]);
$select=strip_tags($_POST[select]);
$joining=strip_tags($_POST[joining]);


list($userName2, $mailDomain2) = split("@",$email); 
	

if(checkdnsrr($mailDomain2, "MX")){

$Body = "
<table width=500 cellspacing=0 cellpadding=0 ><tr><td height=30 align=center valign=middle><font face=verdana size=3 color=#000080><B>Online Enquiry: ASK me Engineers</b></font></td><tr><td height=30 align=center valign=middle><hr color=#000000></td><tr></table>";
$Body = $Body . "<table width=600 cellspacing=0 cellpadding=0 >";
$Body = $Body . "<tr><td width=300 height=20 align=left valign=top><font size=2 face=verdana><b>Name: </b></font></td><td><font size=2 face=verdana>". $name."</font></td></tr>";
$Body = $Body . "<tr><td width=300 height=20 align=left valign=top><font size=2 face=verdana><b>Company: </b></font></td><td><font size=2 face=verdana>". $company."</font></td></tr>";
$Body = $Body . "<tr><td width=300 height=20 align=left valign=top><font size=2 face=verdana><b>Phone No.: </b></font></td><td><font size=2 face=verdana>". $phone."</font></td></tr>";
$Body = $Body . "<tr><td height=20 align=left valign=top><font size=2 face=verdana><b>Mobile: </b></font></td><td><font size=2 face=verdana>" .$mobile."</font></td></tr>";
$Body = $Body . "<tr><td height=20 align=left valign=top><font size=2 face=verdana><b>Email:</b></font></td><td><font size=2 face=verdana>" .$email."</font></td></tr>";
$Body = $Body . "<tr><td height=20 align=left valign=top><font size=2 face=verdana><b>Address: </b></font></td><td><font size=2 face=verdana>" .$address."</font></td></tr>";
$Body = $Body . "<tr><td height=1 align=left valign=top></td></tr>";
$Body = $Body . "<tr><td height=20 align=left valign=top><font size=2 face=verdana><b>Course Interested in:</b></font><br></td><td><font size=2 face=verdana>" .$select."</font></td></tr>";
$Body = $Body . "<tr><td height=1 align=left valign=top><font size=2 face=verdana><b>Preferred Date of Joining:</b></font></td><td><font size=2 face=verdana>" .$joining."</font><br></td></tr>";
$Body = $Body . "<tr><td height=1 align=left valign=top></td></tr>";
$Body = $Body . "</table>
";

$message=$Body; 
$to="sonal@askmeengineer.com, neha@askmeengineer.com, shriyan.r@gmail.com";
$from_email="$email";
$subject = "Online Enquiry: ASK me Engineers";
	//$subject = "Enquiry -$contact_person.";
$mailheaders = '';
$mailheaders.= "from: ".$from_email." \r\n";
$mailheaders.= "MIME-Version: 1.0" . "\r\n";
$mailheaders.= "Content-type: text/html; charset=ISO-8859-1" . "\r\n";


if(!mail($to,$subject,$message,$mailheaders)) {

		//echo "<b></b> Query was not sent <b>Sorry</b><br />";
echo   "<script>
           alert('Please Try Again ')
           history.go(-1);
           </script>";
 }
				
			               
	                      
else{
	header('Location: submitted.htm');
        die;
					
         }




    }
else{
//echo"Your Email id is not validate";
//header('Location: contactus.htm');

 echo   "<script>
           alert('Please enter a valid email id ')
           history.go(-1);
           </script>";
}
?>