isSMTP(); //Send using SMTP $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Host = 'smtp.gmail.com'; //Set the SMTP server to send through $mail->Username = 'p7714129@gmail.com'; //SMTP username $mail->Password = 'sdxflqnencvgwaaw'; //SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable implicit TLS encryption $mail->Port = 587; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom('p7714129@gmail.com', 'Balotra Taxi Service'); $mail->addAddress('p7714129@gmail.com', 'User'); //Add a recipient //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = 'User Enquiry'; $mail->Body = " Pickup Location : $PickupLocation
Drop Off Location : $DropoffLocation
Pickup Date : $PickUpDate
Pickup Time: $PickUpTime
Phone Number : $phone
"; if($mail->send()){ $_SESSION['status'] = "Thank you for sending mail"; header("Location: {$_SERVER['HTTP_REFERER']}"); exit(0); }else{ $_SESSION['status'] = "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; header("Location: {$_SERVER['HTTP_REFERER']}"); exit(0); } } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } }else{ header("Location: contact.php"); } ?>