Answer the question
In order to leave comments, you need to log in
Php does not send letters to the mail. What should I do?
I have a contact form on my site, here is the code -
<form id="contactform" name="contact" method="post" action="page.php">
<div class="row">
<label for="name">Имя,Фамилия <span class="req"></span></label>
<input type="text" name="name" id="name" class="txt" tabindex="1" placeholder="" required>
</div>
<div class="row">
<label for="email">E-mail <span class="req"></span></label>
<input type="email" name="email" id="email" class="txt" tabindex="2" placeholder="" required>
</div>
<div class="row">
<label for="phone">Номер телефона <span class="req"></span></label>
<input type="phone" name="phone" id="phone" class="txt" tabindex="2" placeholder=" " required>
</div>
<div class="row">
<label for="subject">Марка,модель и год выпуска авто <span class="req"></span></label>
<input type="text" name="subject" id="subject" class="txt" tabindex="4" placeholder="" required>
</div>
<div class="row">
<label for="message">Гос. номер авто <span class="req"></span></label>
<input type="text" name="message" id="message" class="txt" tabindex="3" placeholder="" required>
</div>
<div class="center">
<input type="submit" id="submitbtn" name="s" tabindex="5" value="Отправить анкету">
</div>
</form>
<?php
header('Content-type: text/html; charset=utf-8');
header('Refresh: 0.5; url="index.html"');
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$phone = $_POST['phone'];
$subject = $_POST['subject'];
if (mail("[email protected]", "Заявка с сайта", "Имя:".$name ,". E-mail: ".$email , "Телефон:".$phone ,". Авто: ".$subject ,". Гос.номер авто: ".$message ," \r\n"))
{ echo "<h3>Cообщение успешно отправлено. </h3>";
} else {
echo "При отправке сообщения возникли ошибки ";
}
?>
Answer the question
In order to leave comments, you need to log in
You are passing too many parameters to mail and in the wrong format.
ru2.php.net/manual/ru/function.mail.php
Replace line
on the
if (mail("[email protected]", "Заявка с сайта", "Имя:".$name.". E-mail: ".$email. "Телефон:".$phone.". Авто: ".$subject.". Гос.номер авто: ".$message."))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question