Letlabo Nature Reserve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

event.php 1.4KB

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