<?php
class orderMail{
	function orderMailDetails(){	
require_once("class.phpmailer.php");	
//require("PHPMailerAutoload.php");
$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "mail.kalpanapartners.com.my";  // specify main and backup server
//$mail->Port = 465;
//$mail->SMTPAuth = false;
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username= "inquiry@kalpanapartners.com.my";  // SMTP username
$mail->Password = "Kalpanapar@3006"; // SMTP password

//$mail->SMTPDebug  = 2;   
$mail->From ="info@customer.com";
$mail->FromName ='Customer Enquiry';
$mail->AddAddress('inquiry@kalpanapartners.com.my');
//$mail->AddAddress("kuna_shan@yahoo.com");                  // name is optional
//$mail->AddReplyTo("info@example.com", "Information");

$mail->WordWrap = 50;                                 // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject ='Customer Enquiry';
$mail->Body    ='
<html>
<body>
<p><span style="text-transform:uppercase;">Enquiry Details</span></p>
<label style="font-weight:bold;">Name : </label>'.$_POST['name'].'<br>
<label style="font-weight:bold;">Email-Id : </label>'.$_POST['email'].'<br>
<label style="font-weight:bold;">Subject : </label>'.$_POST['subject'].'<br>
<label style="font-weight:bold;">Message : </label>'.$_POST['message'].'<br>
<br>REGARDS
</body>
</html>';
$mail->AltBody = "Confirmation Mail For Insurance";

if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   //exit;
   return 0;
}
 return 1;
//echo "<script type='text/javascript'>alert('Mail Send Sucessfully');</script>";
//echo "<script type='text/javascript'>window.location.href = 'contact.html';</script>";

	}
}

$objLSID=new orderMail();
$getcrcode=$objLSID->orderMailDetails();


$json = array("op" =>$getcrcode);
			
			// send data as json format
			header("Content-Type: application/json",true);
				echo json_encode($json); 


?>