2016-03-27 18 views
0

PHP uzmanı değil. Bununla birlikte, bu sistemi daha önce kullandım ve bir gün çalışmayı durdurmuş gibiydi. Herhangi bir hata mesajı almasam bile e-postalar yollamıyor gibi görünmüyor. Neyin yanlış olduğunu bilmiyorum.PHP iletişim formu çalışıyor, çalışıyor e-posta almıyor

Formu sayfa:

<form method="POST" name="contactform" action="contact-form-handler.php"> 

<label for='name'>Your Name:</label> <br> 
<input type="text" name="name"> 

<label for='email'>Email Address:</label> <br> 
<input type="text" name="email"> <br> 



What does this concern?<br> 
<select name="options"> 
<option value="null">--</option> 
<option value="IEP">IEP</option> 
<option value="Section 504">Section 504</option> 
<option value="Other">Other</option> 
</select> 


<p style="width: 50%">Please include in your message what type of service you are inquiring about. Please be as descriptive as possible so we can help you more efficiently. Thank you.</p> 


<label for='message'>Message:</label> <br> 
<textarea name="message" cols="45" rows="7"></textarea> 

<input type="image" src="img/submit.png" alt="Submit"> <br> 
</form> 

Taşıma:

<?php 
$errors = ''; 
$myemail = '[email protected];'; 
if(empty($_POST['name']) || 
    empty($_POST['email']) || 
    empty($_POST['options']) || 
    empty($_POST['message'])) 
{ 
    $errors .= "\n Error: all fields are required"; 
} 

$name = $_POST['name']; 
$email_address = $_POST['email']; 
$message = $_POST['message']; 
$options = $_POST['options']; 

if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", 
$email_address)) 
{ 
    $errors .= "\n Error: Invalid email address"; 
} 

if(empty($errors)) 
{ 
    $to = $myemail; 
    $email_subject = "Contact form submission: $name"; 
    $email_body = "You have received a new message. ". 
    " Here are the details:\n Name: $name \n Email:  $email_address \n Regarding a(n): $options \n \n Message: \n \n $message"; 

$headers = "From: $myemail\n"; 
$headers .= "Reply-To: $email_address"; 

mail($to,$email_subject,$email_body,$headers); 
//redirect to the 'thank you' page 
header('Location: contact-form-thank-you.php'); 
} 
?> 

<?php include 'template/top.php'; ?> 

<!-- This page is displayed only if there is some error --> 
<?php 
echo nl2br($errors); 
?> 

<?php include 'template/bottom.php'; ?> 
+1

Olası kopyası [PHP posta formu e-posta göndermeyi tamamlamıyor] (http://stackoverflow.com/questions/24644436/php-mail-form-doesnt-complete-sending-e-mail) – Chris

+0

Gmail is * Yetkilendirilmemiş gönderenlerden gelen e-postaları almaya gelince çok seçici. E-postayı göndermek için Gmail’in SMTP’si kullanıyor musunuz? (Gördüğümden değil ama belki de başka bir kod var) Eğer değilse, bu sizin sorununuz olabilir. – Technoh

cevap

İlgili konular