1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
-
- require 'C:\xampp\composer\vendor\phpmailer\PHPMailer\src\Exception.php';
- require 'C:\xampp\composer\vendor\phpmailer\PHPMailer\src\PHPMailer.php';
- require 'C:\xampp\composer\vendor\phpmailer\PHPMailer\src\SMTP.php';
- 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; // Enable debugging
- $mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'infoletlabo@gmail.com';
- $mail->Password = 'Garfield@13';
- $mail->SMTPSecure = 'tls'; // Enable SSL secure email
- $mail->Port = 587; // Port no may change
-
- //Recipients
- $mail->setFrom($email, $name); // User email
- $mail->addAddress('infoletlabo@gmail.com', 'Letlabo Nature Reserve'); // Your email
- $mail->addcc ($email);
- $mail->addReplyTo($email, $name); // Replay to User
- //Content
- $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;
-
- }
- ?>
|