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 (thank you message) $mail->setFrom($gmailUser, 'Bohora Car Rental'); $mail->addAddress($email, $name); // Send to the customer's email address $mail->isHTML(true); $mail->Subject = 'Thanks for Contacting Us!'; $mail->Body = "
Dear $name,
We have received your contact form submission, and our team will get back to you as soon as possible.
Subject: $subject
Message: $message
Phone: $phone
Thank you for reaching out!
"; $mail->AltBody = " Thank you for contacting Bohora Car Rental: Dear $name, We have received your contact form submission, and our team will get back to you as soon as possible. Subject: $subject Message: $message Phone: $phone Thank you for reaching out! "; $mail->send(); // Send email to your Gmail (admin's email) $mail->clearAddresses(); // Clear the previous recipient (customer) $mail->addAddress($gmailUser, 'Bohora Car Rental'); // Send to your company email $mail->Subject = 'New Contact Request'; $mail->Body = "Name: $name
Email: $email
Phone: $phone
Subject: $subject
Message: $message
Please review the details for further action.
"; $mail->AltBody = " You have received a new contact request: Name: $name Email: $email Phone: $phone Subject: $subject Message: $message Please review the details for further action. "; $mail->send(); // Redirect to a thank you page or your contact page exit(); } catch (Exception $e) { // Redirect to an error page if something goes wrong exit(); } } else { echo 'Invalid request method.'; } ?>