isSMTP();
$mail->Host = 'smtp.gmail.com'; // Change this based on your email provider
$mail->SMTPAuth = true;
$mail->Username = 'sspappkeys@gmail.com'; // Your SMTP email
$mail->Password = 'momcjmfzwcfastuu'; // Your SMTP password (use App Passwords for security)
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
// Recipients
$mail->setFrom('sspappkeys@gmail.com');
$mail->addAddress($recipient);
// Content
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = "Name: $name
Number: $number
Email: $email
Message:
$message
Trip Details
Flight_preference: $flight_preference
From_city: $from_city
To_city: $to_city
Depart_date: $depart_date
Return_date: $return_date
Adult_count: $adult_count
Child_count: $child_count
Infant_count: $infant_count
Flight_class: $flight_class
Country: $country
";
if($mail->send()){
$sql1 = "INSERT INTO `flight_bookings`
(`Name`, `Number`, `Email`, `Message`, `Subject`, `flight_preference`, `from_city`, `to_city`, `depart_date`, `return_date`, `adult_count`, `child_count`, `infant_count`, `flight_class`, `country`)
VALUES
('$name', '$number', '$email', '$message', '$subject', '$flight_preference', '$from_city', '$to_city', '$depart_date', '$return_date', '$adult_count', '$child_count', '$infant_count', '$flight_class', '$country')";
if($conn->query($sql1)){
http_response_code(200);
echo
'';
}
}
} catch (Exception $e) {
http_response_code(500);
echo "Error: Could not send email. Mailer Error: {$mail->ErrorInfo}";
}
} else {
http_response_code(403);
echo "There was a problem with your submission. Please try again.";
}
?>