-
Notifications
You must be signed in to change notification settings - Fork 0
/
email.php
38 lines (36 loc) · 1.08 KB
/
email.php
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
<?php
$to = 'nigel@bgcreatives.com';
$email = preg_replace("([\r\n])", "", $_POST['mail']) ;
$name = $_POST['name'] ;
$subject = "Message from: $name";
$message = $_POST['comment'] ;
$match = "/(bcc:|cc:|content\-type:)/i";
if (preg_match($match, $subject) ||
preg_match($match, $body)) {
die("Header injection detected.");
}
$validemail = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
if ($validemail) {
$headers .= "Reply-to: $validemail\r\n";
}
$robotest = $_REQUEST['robotest'];
$body = "From: $name \r\n Email: $email \r\n Message: $message";
mail($to, $subject, $headers, $body) or die("Error Bro!!!");
if($robotest)
$error = "You are a gutless robot.";
else{
if($email == ' ')
{
print("You have not entered an email, please go back and try again");
}
else if ($name == ' ')
{
print("You have not entered a name, please go back and try again");
}
else
{
$send = mail($to, $subject, $body, $headers);
print("Thank you for contacting us. We will be in touch with you very soon.");
}
}
?>