I have a problem sending an email. After filling out and clicking on the button, it says to me that the letter has been sent, but it does not come to the mail. Please help me solve this problem. Thank you.
js
jQuery(document).ready(function () {
$(".phone").mask("+7 (999) 999-99-99");
jQuery('.send-form').click( function() {
var form = jQuery(this).closest('form');
if ( form.valid() ) {
form.css('opacity','.5');
var actUrl = form.attr('action');
jQuery.ajax({
url: actUrl,
type: 'post',
dataType: 'html',
data: form.serialize(),
success: function(data) {
form.html(data);
form.css('opacity','1');
},
error: function() {
form.find('.status').html('Cерверная ошибка');
}
});
}
});
});
php
<?php
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$text = $_POST['text'];
$to = "tihomirovr764@gmail.com";
$date = date ("d.m.Y");
$time = date ("h:i");
$from = $email;
$subject = "Заявка c сайта";
$msg="
Имя: $name /n
Телефон: $phone /n
Почта: $email /n
Текст: $text";
mail($to, $subject, $msg, "From: $from ");
?>
<p>Привет, форма отправлена</p>
<form action="sender.php" method="post" id="form" class="form__body">
<div class="form__item">
<input id="formName" type="text" class="dialog-input" name="name" placeholder="Имя" required>
</div>
<div class="form__item">
<div class="dialog-inputs__telefon">
<div class="dialog-inputs__telefon--flag">
<img src="assets/images/Frame 98 (2).svg" alt="">
<img src="assets/images/Frame 99.svg" alt="">
</div>
<input type="text" class="dialog-input" name="phone" placeholder="Телефон">
</div>
</div>
<div class="form__item">
<input id="formEmail" type="email" placeholder="E-mail" name="email" class="dialog-input" required>
</div>
<div class="form__item">
<textarea name="text" id="" placeholder="Текст сообщения" class="leave-message__text"></textarea>
</div>
<button type="button" class="navbar-nav__button" id="open">Оставить заявку</button>
<div class="status"></div>
</form>
I've tried different ways, but none of them worked. I am not very strong in php, I hope for your help.
I want to see the letter