<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require_once "PHPMailer/src/PHPMailer.php";
require_once "PHPMailer/src/SMTP.php";
require_once "PHPMailer/src/Exception.php";






$mail = new PHPMailer(true);

//Enable SMTP debugging.
$mail->SMTPDebug = 0; //0 or 2 

//Set PHPMailer to use SMTP.
$mail->isSMTP();

//Set SMTP host name                          
$mail->Host = "smtp.gmail.com";

//Set this to true if SMTP host requires authentication to send email
$mail->SMTPAuth = true;

$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);

//Provide username and password     

$mail->Username = "clickexcel@gmail.com";
$mail->Password = "hddknlmptpppmlps";


//If SMTP requires TLS encryption then set it
$mail->SMTPSecure = "tls";

//Set TCP port to connect to
$mail->Port = 587;

$mail->From = "clickexcel@gmail.com";
$mail->FromName = "TravelSolutionIndia.in";

$mail->addAddress("codemytask@gmail.com", "TravelSolutionIndia.in");

$mail->isHTML(true);
$mail->Subject = "Booking details";




$message = "
<table>
Contact Us Form details<br><br>

     Name : ".$_POST["Name"]."<br>
     Pickup Location : ".$_POST["pickupLocation"]."<br>
     Mobile : ".$_POST["Date"]."<br>
     Email : ".$_POST["Email"]."<br>
     Mobile : ".$_POST["Mobile"]."<br>

</table>
";

$mail->Body = $message;

try {
    $mail->send();
    echo "<br><br><br><br><h2 align=center>Message has been sent successfully</h2>";
} catch (Exception $e) {
    echo "Mailer Error: " . $mail->ErrorInfo;
}

 header('Location: http://www.example.com/');
  exit;
























?>