Hello! I can not understand why sending mail with automatic reply is not working correctly. (Initial sending works without problems, auto-answer does not work)
$ send - tried and with the point and without a point, and another variable and stuff, but still: (
And, and in the $ sendfrom variable, for some reason, spaces are always removed from the text. Why? In the rest of the places the spaces everywhere work norms, not here :( and \ r \ n does not help ...
<?php if ($_SERVER["REQUEST_METHOD"] == "POST") { if (!empty($_POST['uname']) && (!empty($_POST['uemail']) && (!empty($_POST['umessage'])))){ if (isset($_POST['uname'])) { if (!empty($_POST['uname'])){ $uname = strip_tags($_POST['uname']) . "<br>"; $unameInput = "<b>Имя:</b><br>"; } } if (isset($_POST['uemail'])) { if (!empty($_POST['uemail'])){ $uemail = strip_tags($_POST['uemail']) . "<br>"; $uemailInput = "<b>Почта:</b><br>"; } } if (isset($_POST['umessage'])) { if (!empty($_POST['umessage'])){ $umessage = strip_tags($_POST['umessage']) . "<br>"; $umessageInput = "<b>Сообщение:</b><br>"; } } if (isset($_POST['uphone'])) { if (!empty($_POST['uphone'])){ $uphone = strip_tags($_POST['uphone']) . "<br>"; $uphoneInput = "<b>Телефон:</b><br>"; } } $to = "mail@skgs.su" . ", "; /*адрес, на который должно приходить письмо*/ $to .= "angel-nwn@yandex.ru" . ", "; $sendfrom = "Comfort System"; /*адрес, с которого будет приходить письмо */ $headers = "From: " . strip_tags($sendfrom) . "\r\n"; $headers .= "Reply-To: ". strip_tags($sendfrom) . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html;charset=utf-8 \r\n"; $headers .= "Content-Transfer-Encoding: 8bit \r\n"; $subject = "Сообщение с сайта"; $subject2 = "Автоответ на письмо"; $body2 = 'Здравствуйте, $name\r\n.<br> Пожалуйста, не отвечайте на это письмо. Оно сформировано автоматически.<br> Вы написали нам письмо, со следующим текстом:'; $message = "$unameInput $uname $uemailInput $uemail $uphoneInput $uphone $umessageInput $umessage"; $send = mail ($to, $subject, $message, $headers); $send .= mail ($uemail, $subject2, $message, $headers); if ($send == 'true'){ echo '<p class="success">Спасибо за отправку вашего сообщения!</p>'; } else { echo '<p class="fail"><b>Ошибка. Сообщение не отправлено!</b></p>'; } } else { echo '<p class="fail">Ошибка. Вы заполнили не все обязательные поля!</p>'; } } else { header ("Location: http://skgs.su"); // главная страница }