Answer the question
In order to leave comments, you need to log in
PHP not sending form data to email?
The essence of the question is in the title.
HTML
<form id="callphone" class="callphone">
<input type="phone" name="phone" id="phone" placeholder="+7 (775) 225-33-44" required>
<button type="submit" class="button">Отправить</button>
<p class="enterinfo">*Введите номер телефона</p>
</form>
$(document).ready(function() {
$("#callphone").submit(function() {
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize()
}).done(function() {
$(this).find("input").val("");
alert("Спасибо за заявку! Скоро мы с вами свяжемся.");
$("#callphone").trigger("reset");
});
return false;
});
});
<?php
$recepient = "[email protected]";
$sitename = "ТОО Информационно-Технологический Сервис";
$phone = trim($_POST["phone"]);
$message = "Телефон: $phone";
$pagetitle = "Новая заявка с сайта \"$sitename\"";
mail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"utf-8\"\n From: $recepient");
Answer the question
In order to leave comments, you need to log in
In most cases such problem is related to the mail() function use PHPMailer or SwiftMailer
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question