forked from jeweltheme/kite-coming-soon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail.php
28 lines (27 loc) · 960 Bytes
/
mail.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
<?php
function spamcheck($field){ //filter_var() sanitizes the e-mail
//address using FILTER_SANITIZE_EMAIL
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
//filter_var() validates the e-mail
//address using FILTER_VALIDATE_EMAIL
if(filter_var($field, FILTER_VALIDATE_EMAIL)) return TRUE;
else return FALSE;
}
if (isset($_REQUEST['email'])){//if "email" is filled out, proceed
//check if the email address is invalid
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE){
echo "Invalid input";
}
else{//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = "<br/>\n\r Name: " . $_REQUEST['name'] ;
$message .= "<br/>\n\r Email: " . $_REQUEST['email'];
$message .="<br/>\n\r Message: ".$_REQUEST['message'] ;
mail("contac@cronj.com", "Subject: $subject", $message, "From: $email" );
echo "success";
//echo "Thank you for using our mail form";
}
}
?>