123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
-
-
- require 'C:\xampp\composer\vendor\autoload.php';
-
- if(isset($_POST['submit'])) {
- $name = $_POST['name'];
- $email = $_POST['email'];
- $phone = $_POST['phone'];
- $arrive = $_POST['arrive'];
- $depart = $_POST['depart'];
- $people = $_POST['people'];
- $message = $_POST['message'];
- $mail = new PHPMailer(true);
- $mail->SMTPDebug = 2;
- $mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'infoletlabo@gmail.com';
- $mail->Password = 'Garfield@13';
- $mail->SMTPSecure = 'tls';
- $mail->Port = 587;
-
-
- $mail->setFrom($email, $name);
- $mail->addAddress('infoletlabo@gmail.com', 'Letlabo Nature Reserve');
- $mail->addcc ($email);
- $mail->addReplyTo($email, $name);
-
- $mail->isHTML(false);
- $mail->Subject = 'Accommodation Request';
-
- $mail->Body = 'Equiry From: '.$name."\r\n".'Booking Dates: ' ."\r\n". 'Start Date: '.$arrive."\r\n".'End Date: '.$depart."\r\n".'Email: '.$email."\r\n".'Phone: '.$phone."\r\n".'Number of People:'.$people."\r\n".'Comments: : '.$message;
-
-
-
-
- if($mail->send()) {
- echo "<script type='text/javascript'>alert('submitted successfully!')</script>";
- }
- else
- {
- echo "<script type='text/javascript'>alert('failed!')</script>";
- }
- header('Location: accommodation.html');
- exit;
-
- }
- ?>
|