Last active
March 12, 2016 07:49
-
-
Save vgrish/39b83c043d655be2cb79 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$('form').submit(function(e) { | |
e.preventDefault(); | |
var name = $(this).find('.name').val(); | |
$.post( | |
'mail.php', { | |
name: name, | |
}, | |
function(d) { | |
} | |
); | |
}); | |
======= | |
$name = substr(htmlspecialchars(trim($_POST['name'])), 0, 1000); | |
$to = 'mail'; | |
$subject = 'subject' | |
$message = ' | |
<html> | |
<head> | |
<title>'.$subject.'</title> | |
</head> | |
<body> | |
</body> | |
</html> | |
'; | |
$headers = 'MIME-Version: 1.0' . "\r\n"; | |
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; | |
$headers .= 'To: <'.$to.'>, '."\r\n"; | |
$headers .= 'From: <mail.ru>' . "\r\n"; | |
mail($to, $subject, $message, $headers); | |
echo 'Спасибо! Ваше письмо отправлено.'; | |
header("Location: ".$_SERVER['HTTP_REFERER']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment