не получая электронные письма формы

Я пробовал раньше без решения, поэтому я добавляю весь свой код, чтобы попытаться решить эту проблему. Я не получаю эту форму в своем почтовом ящике, но моя функция ajax работает так, как должна. У меня есть godaddy хостинг, и я запускаю его локально на wampp для mac. Я пробовал несколько разных адресов электронной почты безрезультатно. Я не хочу использовать php mailer. Я просто хочу, чтобы это функционировало должным образом, а не то, что, по-видимому, делает, что рассылает электронные письма в пространство

HTML

<div class="block"> <div class="done"> <h1>Thank you! I have received your message.</h1> </div> <div class="form"> <form method="post" action="scripts/process.php"> <input name="name" class="text" placeholder="Name" type="text" /> <input name="email" class="text" placeholder="Email" type="text" /> <textarea name="comment" class="text textarea" placeholder="Comment"></textarea> <input name="submit" value="Let's Go!" id="submit" type="submit" /> <div class="loading"></div> </form></div> </div> <div class="clear"></div> </div> </div> 

проверка jquery и ajax

 $('#submit').click(function () { //Get the data from all the fields var name = $('input[name=name]'); var email = $('input[name=email]'); var comment = $('textarea[name=comment]'); var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var emailVal = email.val(); //Simple validation to make sure user entered something //If error found, add hightlight class to the text field if (!emailReg.test(emailVal)){ email.addClass('hightlight'); return false; } else email.removeClass('hightlight'); if (name.val()=='') { name.addClass('hightlight'); }else{name.removeClass('hightlight');} if (email.val()=='') { email.addClass('hightlight'); }else{email.removeClass('hightlight');} if (comment.val()=='') { comment.addClass('hightlight'); }else{email.removeClass('hightlight');} if (name.val()=='' || email.val()=='' || comment.val()=='') { return false; } //organize the data properly var data = 'name=' + name.val() + '&email=' + email.val() + '&website=' + website.val() + '&comment=' + encodeURIComponent(comment.val()); //disabled all the text fields $('.text').attr('disabled','true'); //show the loading sign $('.loading').show(); //start the ajax $.ajax({ //this is the php file that processes the data and send mail url: "scripts/process.php", //GET method is used type: "GET", //pass the data data: data, //Do not cache the page cache: false, //success success: function (html) { //if process.php returned 1/true (send mail success) if (html==1) { //hide the form $('.form').fadeOut('slow'); //show the success message $('.done').fadeIn('slow'); //if process.php returned 0/false (send mail failed) } else alert('Sorry, unexpected error. Please try again later.'); } }); //cancel the submit button default behaviours return false; }); 

и php, о котором я с сожалением говорю, что я очень мало знаю об этом сейчас

 <?php //Retrieve form data. //GET - user submitted data using AJAX //POST - in case user does not support javascript, we'll use POST instead $name = ($_GET['name']) ? $_GET['name'] : $_POST['name']; $email = ($_GET['email']) ?$_GET['email'] : $_POST['email']; $comment = ($_GET['comment']) ?$_GET['comment'] : $_POST['comment']; //flag to indicate which method it uses. If POST set it to 1 if ($_POST) $post=1; //Simple server side validation for POST data, of course, //you should validate the email if (!$name) $errors[count($errors)] = 'Please enter your name.'; if (!$email) $errors[count($errors)] = 'Please enter your email.'; if (!$comment) $errors[count($errors)] = 'Please enter your comment.'; //if the errors array is empty, send the mail if (!$errors) { //recipient - change this to your name and email $to = 'myemail@gmail.com'; //sender $from = $name . ' <' . $email . '>'; //subject and the html message $subject = 'Comment from ' . $name; $message = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head></head> <body> <table> <tr><td>Name</td><td>' . $name . '</td></tr> <tr><td>Email</td><td>' . $email . '</td></tr> <tr><td>Comment</td><td>' . nl2br($comment) . '</td></tr> </table> </body> </html>'; //send the mail $result = sendmail($to, $subject, $message, $from); //if POST was used, display the message straight away if ($_POST) { if ($result) echo 'Thank you! Matt has received your message.'; else echo 'Sorry, unexpected error. Please try again later'; //else if GET was used, return the boolean value so that //ajax script can react accordingly //1 means success, 0 means failed } else { echo $result; } //if the errors array has values } else { //display the errors message for ($i=0; $i<count($errors); $i++) echo $errors[$i] . '<br/>'; echo '<a href="form.php">Back</a>'; exit; } //Simple mail function with HTML header function sendmail($to, $subject, $message, $from) { $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: ' . $from . "\r\n"; $result = mail($to,$subject,$message,$headers); if ($result) return 1; else return 0; } ?> 

Есть так много проблем при отправке писем PHP на разные почтовые серверы. Например, когда я хочу отправить электронное сообщение на хосты GMail, я никогда не добавляю \r для новых строк, и я только перехожу с \n . Возможно, ваша проблема связана с вашими заголовками, я размещаю здесь свой код и вижу, что вы можете получить:

 function send($address, $subject, $content, $from = '', $html = FALSE, $encoding = 'utf-8') { if(empty($address) || empty($content)) return; $headers = ""; if($from != '') { $headers .= "From: {$from}\n"; $headers .= "Reply-To: {$from}\n"; } $headers .= "To: {$address}\n"; if($html) { $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: text/html; charset={$encoding}\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; } $headers .= "X-Priority: 1 (Highest)\n"; $headers .= "X-MSMail-Priority: High\n"; $headers .= "Importance: High\n"; $headers .= "X-Mailer: PHP/" . phpversion(); set_time_limit(30); mail($address, $subject, $content, $headers); } send('myemail@myhost.com', 'title', 'content', 'myemail <myemail@myhost.com>', FALSE);