isSMTP(); $mail->SMTPAuth = true; $mail->Host = 'smtp.gmail.com'; $mail->Username = 'raviranjan88826@gmail.com'; $mail->Password = 'nkdochasslnhzils'; // Use an app password here instead of your Gmail password $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; //Recipients $mail->setFrom('raviranjan88826@gmail.com', 'Hello Taxi'); $mail->addAddress('raviranjan88826@gmail.com', 'User'); //Content $mail->isHTML(true); $mail->Subject = 'User Enquiry'; $mail->Body = " User Name: $name
Phone Number: $phone
Start Destination: $s_destination
End Destination: $e_destination
Date: $date
Time: $time
"; if ($mail->send()) { $_SESSION['status'] = "Thank you for sending mail! We will connect with you shortly."; } else { $_SESSION['status'] = "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } // Redirect to the form page with a session message header("Location: {$_SERVER['HTTP_REFERER']}"); exit(); } catch (Exception $e) { $_SESSION['status'] = "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; header("Location: {$_SERVER['HTTP_REFERER']}"); exit(); } } else { header("Location: {$_SERVER['HTTP_REFERER']}"); exit(); }