Letlabo Nature Reserve
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

book.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. use PHPMailer\PHPMailer\PHPMailer;
  3. use PHPMailer\PHPMailer\Exception;
  4. require 'C:\xampp\composer\vendor\autoload.php';
  5. if(isset($_POST['submit'])) {
  6. $name = $_POST['name'];
  7. $email = $_POST['email'];
  8. $phone = $_POST['phone'];
  9. $arrive = $_POST['arrive'];
  10. $depart = $_POST['depart'];
  11. $people = $_POST['people'];
  12. $message = $_POST['message'];
  13. $mail = new PHPMailer(true);
  14. $mail->SMTPDebug = 2; // Enable debugging
  15. $mail->isSMTP();
  16. $mail->Host = 'smtp.gmail.com';
  17. $mail->SMTPAuth = true;
  18. $mail->Username = 'infoletlabo@gmail.com';
  19. $mail->Password = 'Garfield@13';
  20. $mail->SMTPSecure = 'tls'; // Enable SSL secure email
  21. $mail->Port = 587; // Port no may change
  22. //Recipients
  23. $mail->setFrom($email, $name); // User email
  24. $mail->addAddress('infoletlabo@gmail.com', 'Letlabo Nature Reserve'); // Your email
  25. $mail->addcc ($email);
  26. $mail->addReplyTo($email, $name); // Replay to User
  27. //Content
  28. $mail->isHTML(false);
  29. $mail->Subject = 'Accommodation Request';
  30. $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;
  31. if($mail->send()) {
  32. echo "<script type='text/javascript'>alert('submitted successfully!')</script>";
  33. }
  34. else
  35. {
  36. echo "<script type='text/javascript'>alert('failed!')</script>";
  37. }
  38. header('Location: accommodation.html');
  39. exit;
  40. }
  41. ?>