Answer the question
In order to leave comments, you need to log in
Can't submit completed forms via mail php?
$('.modal').on('hidden.bs.modal', function (e) {
$('input:not(.type)', $(this)).val('');
});
$('form').submit(function(e){
e.preventDefault();
var form_data = {
'name':$(".name", $(this)).val(),
'tel':$(".tel", $(this)).val(),
'price':$("#price", $(this)).val(),
'square':$("#square", $(this)).val(),
'type':$(".type", $(this)).val()
};
$.ajax({
type: "POST",
url: "mail.php",
data: form_data,
success: function(){
$('.modal').modal('hide');
setTimeout(function() {
$('.success').fadeToggle();
}, 1000);
setTimeout(function() {
$('.success').fadeToggle();
}, 2500);
},
error: function() {
alert("Произошла какая то ошибка!");
}
});
<?php
$to = '[email protected]*****.ru' . ', '; // note the comma
$to .= '[email protected]*****.ru';
$subject = 'Birthday Reminders for August';
$tel = trim($_POST["tel"]);
$message = "Телефон: $tel\n";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
mail($to, $subject, $message, $headers);
?>
Answer the question
In order to leave comments, you need to log in
I use this function for a similar task:
function mail_utf8($to, $from_user, $from_email, $subject = '(No subject)', $message = '')
{
#base64_encode() - чтобы отображалась кириллица.
$from_user = "=?UTF-8?B?".base64_encode($from_user)."?=";
$subject = "=?UTF-8?B?".base64_encode($subject)."?=";
$headers = "From: $from_user <$from_email>\r\n".
"MIME-Version: 1.0" . "\r\n" .
"Content-type: text/html; charset=UTF-8" . "\r\n";
return mail($to, $subject, $message, $headers);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question