-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.php
45 lines (36 loc) · 1.54 KB
/
contact.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
39
40
41
42
43
44
45
<?php
// start mail processing here...
if(isset($_POST["fullname"]) && isset($_POST["email"]) && isset($_POST["message"])){
$mail_to = "[email protected]";
$subject = "";//$_POST[""];
$name = $_POST["fullname"];
$email = $_POST["email"];
$message = $_POST["message"];
$email_message = "";
function clean_string( $string ) {
$bad = array ("content-type" , "bcc:" , "to:" ,"cc:" ,"href" );
return str_replace ($bad , "" ,$string);
}
$cleanmail = clean_string($email);
if(filter_var($cleanmail,FILTER_VALIDATE_EMAIL)){
$email_message .= "From: ".clean_string($email)."\n";
}else{
$email_message .= "Email: Invalid\n";
}
$email_message .= "Message:\n\n ".clean_string($message)."\n\nReply to ".clean_string($email);
// create email headers
$headers = 'Reply-To: ' . $email ."\r\n" .'X-Mailer: PHP/' . PHP_VERSION;
if(mail($mail_to, $subject, $email_message, $headers)){
echo <<<_END
<div class="col-xs-12 col-sm-12 col-md-12 alert alert-success"><button class="close" type="button" data-dismiss="alert" aria-hidden="true" >×</button>
Your comment has been delivered. check you mail box for a response.
</div>
_END;
}
else{
echo "nothing was submitted";}
}
?>
<link rel="stylesheet" href="../styles/css/bootstrap.min.css" />
<link rel="stylesheet" href="../styles/js/bootstrap.min.js" />
<a class="btn btn-primary " href="index.html" alt="home" >Go Home</a>