Answer the question
In order to leave comments, you need to log in
Why is the letter not being sent through php when entering mail?
Hello!
I wrote feedback in PHP and everything works fine, but here is one BUT, if you enter "[email protected]" in the email field, then everything works, but if you enter "[email protected]", then the letter is not sent at all.
The mail where the letter comes from Google.
<form id="application" action="php/send.php" method="POST" name="application ">
<input name="name" id="name" maxlength="20" placeholder="Введите ваше имя" required />
<input name="email" type="email" id="email" maxlength="40" placeholder="Введите ваш E-mail" required/>
<input name="telephone" type="Tel" id="telephone" maxlength="20" placeholder="Введите ваш телефон" required />
<button class="FormButton" type="submit" form="application"><i class="fa fa-envelope" aria-hidden="true"></i> Получить прайс </button>
</form>
<?php
$sendto = "[email protected]"; // почта, на которую приходит письмо
$username = $_POST['name']; // данные из поля с Имя
$usertel = $_POST['telephone']; // данные из поля Телефон
$usermail = $_POST['email']; // данные из поля Email
// Формирование заголовка письма
$subject = "Новое сообщение";
$headers = "From: " . strip_tags($usermail) . "\r\n";
$headers .= "Reply-To: ". strip_tags($usermail) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html;charset=utf-8 \r\n";
// Формирование тела письма
$msg = "<html><body style='font-family:Arial,sans-serif;'>";
$msg .= "<h2 style='font-weight:bold;border-bottom:1px dotted #ccc;'>Cообщение с сайта RECO</h2>\r\n";
$msg .= "<p><strong>От кого:</strong> ".$username."</p>\r\n";
$msg .= "<p><strong>Почта:</strong> ".$usermail."</p>\r\n";
$msg .= "<p><strong>Телефон:</strong> ".$usertel."</p>\r\n";
$msg .= "</body></html>";
// отправка сообщения
if(@mail($sendto, $subject, $msg, $headers)) {
echo "<center><h1>Сообщение успешно отправленно</h1><br><h2>Мы свяжемся с вами в ближайшее время! </h2></center>";
} else {
echo "<center><img src='img/ne-otprevleno.png'></center>";
}
?>
Answer the question
In order to leave comments, you need to log in
Most likely, according to a set of features, the letter ends up in spam. I can name a few signs.
First, the Subject header uses characters with codes outside ASCII 0-127.
Secondly, the letter has an HTML part, but no corresponding PLAINTEXT part.
Thirdly, there are no SPF, DKIM and DMARK signatures.
In addition to the reasons listed by Rsa97 , one more possible:
In From
you need to substitute the address of the domain from which the form is sent. (google about a recent vulnerability in phpmailer)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question