-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail.php
More file actions
40 lines (29 loc) · 909 Bytes
/
mail.php
File metadata and controls
40 lines (29 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
// Form Variables
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];
// Outgoing Message
$email_from = 'contact@norspawn.com';
$email_subject = "NoRspawn New Contact Form submission";
$email_body = "You have received a new message.\n" .
"User: $name\n" .
"Email: $visitor_email\n" .
"Message:\n $message";
// Headers
$to = "contact@norspawn.com";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
//honey pot field
$honeypot = $_POST['firstname'];
//check if the honeypot field is filled out. If not, send a mail.
if( $honeypot > 1 ){
return; //you may add code here to echo an error etc.
} else {
mail($to, $email_subject, $email_body, $headers);
}
// Redirect to results page
header('HTTP/1.1 301 Moved Permanently');
header('Location: thank-you');
die();
?>