Git for the orangehattech website https://orangehattech.com
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.

submit.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. require 'dep/PHPMailer.php';
  3. require 'dep/SMTP.php';
  4. require 'dep/Exception.php';
  5. use PHPMailer\PHPMailer\PHPMailer;
  6. include('header.html');
  7. if ($_SERVER['REQUEST_METHOD'] != 'POST') {
  8. echo "<h3>Captcha issue. Sorry! Please try again.</h3></div><br></div>";
  9. return false;
  10. }
  11. include 'dep/passwords.php';
  12. $recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
  13. $recaptcha_secret = '6Lcfr4oUAAAAAOGq_qmr43e66cqbXSAj9yVbmb6e';
  14. $recaptcha_response = $_POST['recaptcha_response'];
  15. $recaptcha = file_get_contents($recaptcha_url . '?secret=' . $recaptcha_secret . '&response=' . $recaptcha_response);
  16. $recaptcha = json_decode($recaptcha);
  17. if ($recaptcha->score < 0.5) {
  18. echo "<h3>Captcha issue. Sorry! Please try again.</h3></div><br></div>";
  19. return false;
  20. }
  21. $mail = new PHPMailer(true);
  22. $mail->isSMTP();
  23. $mail->Host = 'smtp.zoho.com';
  24. $mail->SMTPAuth = true;
  25. $mail->Username = $smtpusername;
  26. $mail->Password = $smtppassword;
  27. $mail->Port = 465;
  28. $mail->SMTPSecure = 'ssl';
  29. $mail->From = 'noreply@orangehattech.com';
  30. $mail->FromName = 'orangehattech.com';
  31. $mail->addAddress('jeff@orangehattech.com'); // Add a recipient
  32. $mail->addReplyTo($_POST['e']);
  33. $mail->WordWrap = 50; // Set word wrap to 50 characters
  34. $mail->Subject = 'OHT Contact';
  35. $mail->Body = $_POST['m'];
  36. if(!$mail->send()) {
  37. echo "Message could not be sent. Sorry. I'll try to fix that soon.";
  38. } else {
  39. echo "<h3>Message received. Give me a day or two to reply. Thank you!</h3>";
  40. }
  41. include('footer.html');
  42. ?>