<?php require("PHPMailer/PHPMailerAutoload.php");

// ADD your Email and Name
$recipientEmail='info@facilitymanagements.in';
$recipientName='Facility Manamgent';

//collect the posted variables into local variables before calling $mail = new mailer

$senderName = $_POST['NAME'];
$senderEmail= $_POST['EMAIL'];
$senderPhone= $_POST['PHONE'];
$senderMessage= $_POST['msg'];
$senderService= $_POST['SERVICE'];
$senderSubject = 'New Message From ' . $senderName;

//Create a new PHPMailer instance
$mail = new PHPMailer();

//Set who the message is to be sent from
$mail->setFrom($recipientEmail, $recipientName);
//Set an alternative reply-to address
$mail->addReplyTo($senderEmail,$senderName);
//Set who the message is to be sent to
$mail->addAddress($senderEmail, $senderName );
//Set the subject line
$mail->Subject = $senderSubject;

$mail->Body = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);
$mail->AddAddress($recipientEmail, $recipientName);

//$mail-&gt;AddAttachment("images/phpmailer.gif"); // attachment
//$mail-&gt;AddAttachment("images/phpmailer_mini.gif"); // attachment

//now make those variables the body of the emails
$message = '<html><body>';
$message .= '<table rules="all" style="border:1px solid #666;width:300px;" cellpadding="10">';
$message .= ($senderName) ? "<tr style='background: #eee;'><td><strong>Name:</strong> </td><td>" . $senderName . "</td></tr>" : '';
$message .= ($senderEmail) ?"<tr><td><strong>Email:</strong> </td><td>" . $senderEmail . "</td></tr>" : '';
$message .= ($senderPhone) ?"<tr><td><strong>Phone:</strong> </td><td>" . $senderPhone . "</td></tr>" : '';
$message .= ($senderMessage) ?"<tr><td><strong>Message:</strong> </td><td>" . $senderMessage . "</td></tr>" : '';
$message .= ($senderService) ?"<tr><td><strong>Service:</strong> </td><td>" . $senderService . "</td></tr>" : '';

$message .= "</table>";
$message .= "</body></html>";

$mail->Body = $message;

// $mail->Body="
// Name:$senderName<br/>
// Email: $senderEmail<br/>
// Suburb: $senderSubject<br/>
// Message: $senderMessage";
$headers = "From: $senderEmail\r\n"; // This takes the email and displays it as who this email is from.
$headers = "Content-type: text/html\r\n"; // This tells the server to turn the coding into the text.

if(!$mail->Send()) {
	echo '<div class="alert alert-danger" role="alert">Error: '. $mail->ErrorInfo.'</div>';
	header('Refresh: 10; URL=https://facilitymanagements.in');
} else {
	echo '<div class="alert alert-success" role="alert">Thank you. We will contact you shortly.</div>';
	header('Refresh: 10; URL=https://facilitymanagements.in');


}
?>