// <?php
// if (isset($_POST['submit'])) {
// 	$name=$_POST['name'];
// 	$email=$_POST['email'];
//     $phone=$_POST['contact'];
	
// 	$message=$_POST['message'];

// 	$word = "http"; 
 

// 	$headers='From:'.$email."\n".'Reply-To:'.$email."\n".	
//     'X-Mailer: PHP/' . phpversion()."\n".'content-type :text/html;charset=UTF-8';
// 	$message='<br>Name: '.$name.'<br>Email: '.$email.'<br>Phone: '.$phone.'<br>Message: '.$message. '<br>';
// 	if(mail('namrata@brandbucketsofttech.com','enquiry mail from contact page',$message,$headers)){
	    
	  
// 	   // echo "123";
// 		header('Location:contact.html?Message=sent');
// 	}
// else{
//     //   echo "123456";
// 	header('Location:contact.html?Message=error');
// }
	
// }

<?php

require 'PHPMailer/src/Exception.php'; 
require 'PHPMailer/src/PHPMailer.php'; 
require 'PHPMailer/src/SMTP.php';
use PHPMailer\PHPMailer\PHPMailer; 
use PHPMailer\PHPMailer\Exception; 

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['contact'];
    $subject = $_POST['subject'];
    $msg = $_POST['message'];
   

    
    $mail = new PHPMailer;
    $mail->isSMTP();
    $mail->SMTPDebug = 2;
    $mail->Host = 'smtp.hostinger.com';
    $mail->Port = 587;
    $mail->SMTPAuth = true;
    $mail->Username = ' ';
    $mail->Password = ' ';
    $mail->setFrom(' ', 'EUC Technowood');
    $mail->addReplyTo(' ', 'Support');
    $mail->addAddress(' ', 'Admin');
    $mail->Subject = 'Enquiry Mail From EUC Technowood Website';
    
    // Creating email body
    $body = "<h3>New Enquiry Details</h3>";
    $body .= "<p><strong>First Name:</strong> $name</p>";
    $body .= "<p><strong>Email:</strong> $email</p>";
    $body .= "<p><strong>Contact Number:</strong> $phone</p>";
    $body .= "<p><strong>Service:</strong> $subject</p>";
    $body .= "<p><strong>Message:</strong> $msg</p>";
    
    
    $mail->isHTML(true);
    $mail->Body = $body;
    
    if ($mail->send()) {
        
        header('Location: thanks.html');
    } else {
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    }
} else {
    echo 'Invalid request method.';
}
?>