<?php session_start();
require("class.phpmailer.php");

		$Name=$_POST['textfield'] ; 
		$rplyto=$_POST['textfield22'] ; 
		$telephonenumber=$_POST['textfield42'] ; 
		$designation=$_POST['textfield3'] ;
		$company=$_POST['textfield4'] ;
		$location=$_POST['select'] ;
		$Message=$_POST['textfield423'] ;
		
		//$to="gurumurthy.r@netsoftindia.in";
		//$to="enquiries@senddex.com";
		//$from = "$rplyto";
		$headers = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
		$headers .= "From: $rplyto";		
		$msgbody ='<table width="350" border="0" cellspacing="2" cellpadding="0" align="left">
				  <tr>
					<td align="left"> <b> Name </b></td>
					<td align="left"> <b> : </b></td>
					<td align="left">'.$Name.'</td>
				  </tr>
				  <tr>
					<td align="left"> <b> Designation</b></td>
					<td align="left"> <b> : </b></td>
					<td align="left">'.$designation.'</td>
				  </tr>
				    <tr>
					<td align="left"> <b> Company</b></td>
					<td align="left"> <b> : </b></td>
					<td align="left">'.$company.'</td>
				  </tr>
				  <tr>
					<td align="left"> <b> Email ID </b></td>
					<td align="left"> <b> : </b></td>
					<td align="left">'.$rplyto.'</td>
				  </tr>
				  <tr>
					<td align="left"> <b> Mobile </b></td>
					<td align="left"> <b> : </b></td>
					<td align="left">'.$telephonenumber.'</td>
				  </tr>
				  <tr>
					<td align="left"> <b> Location</b></td>
					<td align="left"> <b> : </b></td>
					<td align="left">'.$location.'</td>
				  </tr>
				  <tr>
					<td align="left"> <b> Message</b></td>
					<td align="left"> <b> : </b></td>
					<td align="left">'.$Message.'</td>
				  </tr>
				  </table>';

$mail = new PHPMailer();

//$toaddress = "gururam.murthy@gmail.com";  //Change this to the email address you will be receiving your notices.
$toaddress= "enquiries@senddex.com";

//$mailhost = "mymail.brinkster.com";  //Change this to your actual Domain name.
//$mailhost = "webmail.senddex.com"; 
$mailhost = "smtp.gmail.com";

//$fromaddress ="enquiries@senddex.com";  //Change this to the email address you will use to send and authenticate with.
$fromaddress ="harish.p423@gmail.com";
//$fromaddress ="noreplytest.test@gmail.com";
//$frompwd = "welcome123";  //Change this to the above email addresses password.
$frompwd ="harish2010";
//$frompwd ="noreplytest";

$subject = "Senddex Enquiry Form";  //Change this to your own email message subject.

$mail->IsSMTP();

$mail->Host = $mailhost;

$mail->SMTPAuth = true;

$mail->Username = $fromaddress;

$mail->Password = $frompwd;

$mail->From = $rplyto;

$mail->FromName = $rplyto;

$mail->SMTPSecure = "ssl";

$mail->Port = 465;

$mail->AddAddress($toaddress);

$mail->AddReplyTo($rplyto);  

$mail->IsHTML(true);

$mail->Subject = $subject;

$mail->Body = $msgbody;


if(!$mail->Send())
{
   $_SESSION['msg']= "Message could not be sent."; 
 }
else
{
$_SESSION['msg']= "Thank you, your message has been sent!";
}				  								  
				   
header("Location:enquiry.php");
				   
				  

?>