isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = $gmailUser; $mail->Password = $gmailPassword; $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; $mail->Port = 465; // Send email to the customer $mail->setFrom($gmailUser, 'Bohora Rental'); $mail->addAddress($email, $name); // Send to the customer's email address $mail->isHTML(true); $mail->Subject = 'Booking Confirmation'; $mail->Body = "tbub jgpc jmwp iznl
Name: $name
Car Name: $car_name
Phone: $phone
Drop -off Location: $location
Pick-up Date: $pickup_date
Drop-off Date: $dropoff_date
Thank you for your booking! We will contact you shortly for further details.
"; $mail->AltBody = " Your booking request has been received: Name: $name Phone: $phone Drop off Location: $location Pick-up Date: $pickup_date Drop-off Date: $dropoff_date Thank you for your booking! We will contact you shortly for further details. "; $mail->send(); // Send email to your Gmail (admin's email) $mail->clearAddresses(); // Clear the previous recipient (customer) $mail->addAddress($gmailUser, 'Your Company'); // Send to your company email $mail->Subject = 'New Booking Request'; $mail->Body = "Name: $name
Car Name: $car_name
Email: $email
Phone: $phone
Drop off: $location
Pick-up Date: $pickup_date
Drop-off Date: $dropoff_date
Please review the details for further action.
"; $mail->AltBody = " You have received a new booking request: Name: $name Email: $email Phone: $phone Address: $address Drop-of Location: $location Pick-up Date: $pickup_date Drop-off Date: $dropoff_date Car name : $car_name Please review the details for further action. "; $mail->send(); header('Location: car-grid.php'); // Redirect back to the form page after submission exit(); } catch (Exception $e) { header('Location: car-grid.php'); // Redirect back to the form page exit(); } } else { echo 'Invalid request method.'; } ?>