PHP联系人表单似乎有效,但没有收到电子邮件



不是PHP专家。话虽如此,我以前使用过这个系统,但似乎有一天它停止了工作。即使我没有收到任何错误消息,我似乎也无法再收到电子邮件了。我不知道怎么了。

表单页面:

<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>

处理:

<?php 
$errors = '';
$myemail = 'louie540x@gmail.com;';
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: $myemailn"; 
$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'; ?>
$myemail = 'louie540x@gmail.com;';

应为:

$myemail = 'louie540x@gmail.com';

然而,这可能不是你唯一的问题。。。

最新更新