mirror of
https://github.com/EyeTrackVR/EyeTrackVR-Docs.git
synced 2025-11-04 14:49:44 +08:00
- Added JQuery, owlcarousel.min.js, jquery validate, popper.min.js, and threejs support. - Added PHP script to send email from form front-end - Will add form next
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
// Replace this with your own email address
|
|
$to = 'example@example.com';
|
|
|
|
function url(){
|
|
return sprintf(
|
|
"%s://%s",
|
|
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
|
|
$_SERVER['SERVER_NAME']
|
|
);
|
|
}
|
|
|
|
if($_POST) {
|
|
|
|
$fname = trim(stripslashes($_POST['fname']));
|
|
$lname = trim(stripslashes($_POST['fname']));
|
|
$email = trim(stripslashes($_POST['email']));
|
|
$subject = trim(stripslashes($_POST['subject']));
|
|
$contact_message = trim(stripslashes($_POST['message']));
|
|
|
|
$name = $fname . ' ' . $lname;
|
|
|
|
if ($subject == '') { $subject = "Contact Form Submission"; }
|
|
|
|
// Set Message
|
|
$message .= "Email from: " . $name . "<br />";
|
|
$message .= "Email address: " . $email . "<br />";
|
|
$message .= "Message: <br />";
|
|
$message .= nl2br($contact_message);
|
|
$message .= "<br /> ----- <br /> This email was sent from your site " . url() . " contact form. <br />";
|
|
|
|
// Set From: header
|
|
$from = $name . " <" . $email . ">";
|
|
|
|
// Email Headers
|
|
$headers = "From: " . $from . "\r\n";
|
|
$headers .= "Reply-To: ". $email . "\r\n";
|
|
$headers .= "MIME-Version: 1.0\r\n";
|
|
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
|
|
|
|
ini_set("sendmail_from", $to); // for windows server
|
|
$mail = mail($to, $subject, $message, $headers);
|
|
|
|
if ($mail) { echo "OK"; }
|
|
else { echo "Something went wrong. Please try again."; }
|
|
|
|
}
|
|
|
|
?>
|