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

$mail = new PHPMailer;
//$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'mail.lucawholesale.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'enquiries@lucawholesale.com';                 // SMTP username
$mail->Password = 'BladeRunner#';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 2626;                                    // TCP port to connect to

$mail->From = 'enquiries@lucawholesale.com';
$mail->FromName = 'Mailer';
$mail->addAddress('sales@lucawholesale.com');     // Add a recipient
$mail->addAddress('daniel@lucawholesale.com','Daniel Luca');               // Name is optional
//$mail->addReplyTo('info@example.com', 'Information');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');

//$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 = 'Message from a LucaWholesale.com User';

$AltBody  = 'Message from a LucaWholesale.com User. ';

$body ='<html>
<head>
  <title>Message Sent</title>
</head>
<body>';

	$name = $_POST['name'];
	$email = $_POST['Email'];
	$town = $_POST['company'];
	$phone = $_POST['Phone'];
	$heard = $_POST['hearaboutus'];
	$message = $_POST['message'];
	
	$body .= '<h3>You have received a message from a LucaWholesale.com User</h3>';
	$body .= '<br>Name : ' . $name ;
	$body .= '<br>Email : ' . $email ;
	$body .= '<br>Company : ' . $company ;
	$body .= '<br>Phone : ' . $phone ;
	$body .= '<br>Message : ' . $message;
	$body .= '</body></html>';
	$mail->Body    = $body ;
	
	$AltBody.= 'You have received a message from a LucaWholesale.com User/n';
	$AltBody.= 'Name : ' . $name ;
	$AltBody.= '/nEmail : ' . $email ;
	$AltBody.= '/nCompany : ' . $company ;
	$AltBody.= '/nPhone : ' . $phone ;
	$AltBody.= '/nMessage : ' . $message;


	$mail->AltBody = $AltBody;
?> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<!-- #BeginTemplate "main.dwt" -->

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link rel="stylesheet" href="style.css" />
<!-- #BeginEditable "doctitle" -->
<title>Your message has been sent</title>
<!-- #EndEditable -->
</head>

<body>


<div id="container">
<table id="Table_01"   border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td colspan="11">
			<img src="images/Luca_01.gif" width="1000" height="211" alt=""></td>
	</tr>
	<tr>
		<td>
			<img src="images/Luca_02.gif" width="52" height="38" alt=""></td>
		<td>
		<a href="default.html" onmouseover="document.home.src='images/mouseovers/Luca_03.jpg'"  onmouseout="document.home.src='images/Luca_03.gif'"> 
			<img src="images/Luca_03.gif" width="92" height="38" alt="Home" name="home"></a></td>
		<td>
			<img src="images/Luca_04.gif" width="82" height="38" alt="About Us"></td>
		<td>
		<a href="about.html" onmouseover="document.about.src='images/mouseovers/Luca_05.jpg'"  onmouseout="document.about.src='images/Luca_05.gif'"> 
			<img src="images/Luca_05.gif" width="120" height="38" alt="About"   name="about"></a></td>
		<td>
			<img src="images/Luca_06.gif" width="87" height="38" ></td>
		<td>
		<a href="service.html" onmouseover="document.Service.src='images/mouseovers/Luca_07.jpg'"  onmouseout="document.Service.src='images/Luca_07.gif'"> 
			<img src="images/Luca_07.gif" width="95" height="38" alt="Service" name="Service" ></a></td>
		<td>
			<img src="images/Luca_08.gif" width="83" height="38" alt=""></td>
		<td>
		<a href="zoki/index.php" onmouseover="document.Products.src='images/mouseovers/Luca_09.jpg'"  onmouseout="document.Products.src='images/Luca_09.gif'">
			<img src="images/Luca_09.gif" width="122" height="38" alt="Products" name="Products"></a></td>
		<td>
			<img src="images/Luca_10.gif" width="77" height="38" alt=""></td>
		<td>
		<a href="contact.html" onmouseover="document.Contact.src='images/mouseovers/Luca_11.jpg'"  onmouseout="document.Contact.src='images/Luca_11.gif'">
			<img src="images/Luca_11.gif" width="137" height="38" alt="Contact Us" name="Contact"></a></td>
		<td>
			<img src="images/Luca_12.gif" width="53" height="38" alt=""></td>
	</tr>
</table>
<div id="bodytext">
<!-- #BeginEditable "body" -->
<div id="bodytext0">
	<div style="height:500px">
		<?php
		if(!empty($email)){
			if(!$mail->send()) {
			    echo 'Mailer Error - Please send your message or question to : info@lucawholesale.com ';
			    echo 'Mailer Error: ' . $mail->ErrorInfo;
			} else {
			    echo '<h3>Thank you. Your Message or question has been sent.</h3><p>Someone will reply to you shortly.</p>';
			}

	
		}else
		{
			echo "<h3>You did not enter your Email Address</h3><p>Please return to the form and retry</p>";
		}
		
		?>	

	</div>
</div>

	<!-- #EndEditable -->
	</div>
</div>	
<div id="footer">
		<div class="footertext">
		<br/><p style="text-align:center">Luca Wholesale Ltd, Unit 3,Evtol Trading Estate, Frederick Street, Newport, Gwent, NP20 2DR<br/>Tel/Fax: 01633 213900
		<br/>Copyright &copy; 2011 Luca Wholesale Ltd. <br/><a href="http://www.redbrooktech.com">Website designed and created by</a> <a href="http://www.redbrooktech.com">Redbrook Technology</a></p>
		</div>
</div>

</body>

<!-- #EndTemplate -->

</html>
