When the form results are sent to the email, it looks unreadable, how can this be corrected? I have already entered the encoding but for some reason it continues to come with broken text. php:
<?php $ToEmail = 'myemail@gmail.com'; $EmailSubject = 'Обратный вызов'; $mailheader = "From: ".$_POST["email"]."\r\n"; $mailheader .= "Content-type: text/html; charset=\"utf-8\""; $MESSAGE_BODY .= "Имя: ".$_POST["name"]."\n"; $MESSAGE_BODY .= "Телефон: ".$_POST["phone"]."\n"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); ?> js:
$("#callbackForm").submit(function() { $.ajax({ url: "callback.php", method: "POST", data: { name: $("#callbackForm input[name='name']").val(), phone: $("#callbackForm input[name='phone']").val() }, success: function(data) { $("#callbackForm input[name='name']").val(""), $("#callbackForm input[name='phone']").val(""), $("#subCallback").attr("value", "отправлено"); } }); return false; });
<form action="" method="post" accept-charset="UTF-8">- Dmitriy Kondratiuk