Почтовая форма – я не получал электронную почту

Я немного разбираюсь в тегах, также я успешно редактировал CMS с именем GetSimple, и все работает отлично (несколько месяцев назад). Теперь, через пару месяцев, я начал с этого и не могу пройти …

У меня есть массаж успешной отправки … «Спасибо, что связались с нами. Мы скоро свяжемся с вами», но я не получил почту. Я пробовал разные примеры HTML и PHP из Интернета, но это та же проблема.

HTML

<form method="POST" action="send.php" class="left" enctype="text/plain"> <input type="hidden" name="form-name" value="contact" /> <fieldset> <label for="your_name">YOUR NAME *</label><input type="text" id="your_name" name="your_name" class="required" /><br/> <label for="your_email">YOUR email *</label><input type="text" id="your_email" name="your_email" class="required email" /><br/> <label for="current_site">current site</label><input type="text" id="current_site" name="current_site" /><br/> <label for="estimated_budget">estimated budget</label><input type="text" id="estimated_budget" name="estimated_budget" /><br/> <label for="project_description">project description</label> <textarea id="project_description" name="project_description"></textarea><br/> <!--<input type="submit" value="send" id="sendbutton"> --> <button class="defaultButton small" id="quotebutton"><span class="buttonLabel">Send</span></button> </fieldset> </form> 

PHP с именем «send.php»

 <?php if(isset($_POST['email'])) { $email_to = "mymail@gmail.com"; $email_subject = "example subject"; $your_name = $_POST['your_name']; // required $your_email = $_POST['your_email']; // required $error_message = "Please enter valid e-mail adress"; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Name: ".clean_string($your_name)."\n"; $email_message .= "Mail: ".clean_string($your_email)."\n"; $email_message .= "Current site: ".clean_string($current_site)."\n"; $email_message .= "Estimated budget: ".clean_string($estimated_budget)."\n"; $email_message .= "Project description: ".clean_string($project_description)."\n"; // create email headers $headers = 'From: '.$your_email."\r\n". 'Reply-To: '.$your_email."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> } <!-- place your own success html below --> Thank you for contacting us. We will be in touch with you very soon. <?php die(); ?> 

Согласно вашему сценарию, кнопка отправки должна содержать имя «email»,

 <input type="submit" value="send" id="sendbutton"> 

поэтому исправление:

 <input type="submit" value="send" name="email" id="sendbutton" /> 

Удалите теги заметок html из вашей формы. полный код:

 <form method="POST" action="send.php" class="left" enctype="text/plain"> <input type="hidden" name="form-name" value="contact" /> <fieldset> <label for="your_name">YOUR NAME *</label><input type="text" id="your_name" name="your_name" class="required" /><br/> <label for="your_email">YOUR email *</label><input type="text" id="your_email" name="your_email" class="required email" /><br/> <label for="current_site">current site</label><input type="text" id="current_site" name="current_site" /><br/> <label for="estimated_budget">estimated budget</label><input type="text" id="estimated_budget" name="estimated_budget" /><br/> <label for="project_description">project description</label> <textarea id="project_description" name="project_description"></textarea><br/> <input type="submit" name="email" value="send" id="sendbutton"> </fieldset> 

Сначала я думаю, что ваши недостающие заголовки смотрят на те

 // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n"; $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n"; $headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n"; 

2-й проверить, является ли его истинным или ложным при вызове функции почты

 if( mail($email_to, $email_subject, $email_message, $headers)!==true) { die('Fail to send'); } die('Sucess'); }