contact.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Requires the "PHP Email Form" library
  4. * The "PHP Email Form" library is available only in the pro version of the template
  5. * The library should be uploaded to: vendor/php-email-form/php-email-form.php
  6. * For more info and help: https://bootstrapmade.com/php-email-form/
  7. */
  8. // Replace contact@example.com with your real receiving email address
  9. $receiving_email_address = 'contact@example.com';
  10. if( file_exists($php_email_form = '../assets/vendor/php-email-form/php-email-form.php' )) {
  11. include( $php_email_form );
  12. } else {
  13. die( 'Unable to load the "PHP Email Form" Library!');
  14. }
  15. $contact = new PHP_Email_Form;
  16. $contact->ajax = true;
  17. $contact->to = $receiving_email_address;
  18. $contact->from_name = $_POST['name'];
  19. $contact->from_email = $_POST['email'];
  20. $contact->subject = $_POST['subject'];
  21. // Uncomment below code if you want to use SMTP to send emails. You need to enter your correct SMTP credentials
  22. /*
  23. $contact->smtp = array(
  24. 'host' => 'example.com',
  25. 'username' => 'example',
  26. 'password' => 'pass',
  27. 'port' => '587'
  28. );
  29. */
  30. $contact->add_message( $_POST['name'], 'From');
  31. $contact->add_message( $_POST['email'], 'Email');
  32. $contact->add_message( $_POST['message'], 'Message', 10);
  33. echo $contact->send();
  34. ?>