MMCT TEAM
1Server IP : 2a02:4780:11:1776:0:2637:29db:10  /  Your IP : 216.73.216.142
Web Server : LiteSpeed
System : Linux in-mum-web1676.main-hosting.eu 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
User : u641149403 ( 641149403)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u641149403/domains/mistytourandtravel.in/../makemytourindia.com/public_html/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u641149403/domains/mistytourandtravel.in/../makemytourindia.com/public_html/thankyou.php
<?php
include('include/common.php');
session_start();

// Check if $html exists in session
$html = $_SESSION['background_mail']['html'] ?? '';

if (empty($html)) {
    echo "<h3>Debug Info</h3>";
    echo "<p>No form data found to send email.</p>";
    exit;
}

// Clear session immediately so page can be refreshed safely
unset($_SESSION['background_mail']);

// Prepare a mail sending function
function sendBookingEmail($html) {
    include('smtp/PHPMailerAutoload.php');
    try {
        $mail = new PHPMailer(true);
        $mail->isSMTP();
        $mail->Host = 'smtp.hostinger.com';
        $mail->Port = 465;
        $mail->SMTPSecure = 'ssl';
        $mail->SMTPAuth = true;
        $mail->Username = 'info@makemytourindia.com';
        $mail->Password = 'Makemy@76646';
        $mail->setFrom('info@makemytourindia.com', 'Booking Details');
        $mail->addAddress('jimcorbettaman@gmail.com'); // Your email
        $mail->isHTML(true);
        $mail->Subject = 'Booking Enquiry';
        $mail->Body = $html;
        $mail->Timeout = 30;

        if ($mail->send()) {
            error_log("Email sent successfully.");
        } else {
            error_log("Email delivery failed, but form was submitted.");
        }
    } catch (Exception $e) {
        error_log("Email failed: " . $mail->ErrorInfo);
    }
}

// Flush output so the page shows first
ob_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Thank You - <?=SITE_NAME?></title>
	<?php include('include/header.php');?>
</head>
<body>

<section class="response-section py-5 text-center">
    <div class="container">
      <div class="row">
        <div class="col-lg-6 mx-auto">
          <div class="card">
            <div class="card-icon">
              <i class="fa-solid fa-circle-check"></i>
            </div>
            <div class="card-body">
              <h2>You're all set!</h2>
              <p>Thanks for contacting us. Our expert will get in touch with you shortly.</p>
              <!-- <p><small>Email will be sent shortly in the background.</small></p> -->
            </div>
            <a href="<?=SITE_URL?>" class="btn-theme">
                <span><i class="fa-solid fa-arrow-left pe-2"></i> Go Back To Home</span>
            </a>
          </div>
        </div>
      </div>
    </div>
</section>

<?php include('include/footer.php');?>

<?php
// Flush the output so the user sees the page first
ob_end_flush();
flush();

// Send email after content is sent
sendBookingEmail($html);
?>

MMCT - 2023