-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.php
50 lines (32 loc) · 1.12 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
39
40
41
42
43
44
45
46
47
48
49
50
<?php
if(isset($_POST['email'])) {
if(strlen($_POST['username']) > 1) {
die('no spam');
}else{
$email_will = "[email protected]";
$email_perry = "[email protected]";
$email_subject = "Website interest";
$first_name = $_POST['name'];
$email_from = $_POST['email'];
$comments = $_POST['comment'];
$email_message = "Contact from tiny rhino.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($email_will, $email_subject, $email_message, $headers) && mail($email_perry, $email_subject, $email_message, $headers)){
echo 'mail successful send';
}
else{
echo 'there’s some errors to send the mail, verify your server options';
}
}
}
?>