Created
April 26, 2018 09:36
-
-
Save madeas/947c63d6cb4396109db679d7280e6c50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_SERVER["REQUEST_METHOD"] == "POST") { | |
if (isset($_POST['formData'])) {$formData = $_POST['formData'];} | |
if (isset($_POST['email'])) {$email = $_POST['email'];} | |
if (isset($_POST['name'])) {$name = $_POST['name'];} | |
if (isset($_POST['phone'])) {$phone = $_POST['phone'];} | |
if (isset($_POST['message'])) {$message = $_POST['message'];} | |
$to = "your@email.ru"; /*Укажите ваш адрес электронной почты*/ | |
$headers = "Content-type: text/plain; charset = utf-8"; | |
$subject = "$formData"; | |
$message = "$formData\n\nОткуда: $email \n\nОтправитель: $name \n\nТелефон: $phone \n\nСообщение: $message"; | |
$send = mail ($to, $subject, $message, $headers); | |
if ($send == 'true') | |
{ | |
echo "<center>Спасибо за отправку вашего сообщения! Наши специалисты свяжутся с вами в течение часа.</center>"; | |
} | |
else | |
{ | |
echo "<center><b>Ошибка. Сообщение не отправлено! Проверьте правильность введенных данных</b></center>"; | |
} | |
} else { | |
http_response_code(403); | |
echo "Попробуйте еще раз"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment