联系表未与我的邮件服务器通信,怎么了?
Contact form not communicating with my mail server, whats up?
这里真的很奇怪...希望其他人也能看起来...谢谢。
这是我正在使用的HTML:
<div id="contactform">
<form name="sentMessage" id="contactForm" novalidate action="" class="popup-form">
<input type="text" class="form-control form-white" id="name" name="name" placeholder="Full Name">
<input type="text" class="form-control form-white" id="phone" name="phone" placeholder="Email Address">
<input type="text" class="form-control form-white" id="email" name="email" placeholder="Phone Number">
<input type="text" class="form-control form-white" id="reach" name="reach" placeholder="Best Form of Contact">
<input type="text" class="form-control form-white" id="attendees" name="attendees" placeholder="Number of Guests">
<input type="text" id="overnight" name="overnight" class="form-control form-white" placeholder="Number of Overnight Guests">
<input type="text" class="form-control form-white" id="event" name="event" placeholder="Type of Event">
<input type="text" class="form-control form-white" id="meals" name="meals" placeholder="Meals included?">
<input type="text" class="form-control form-white" id="date" name="date" placeholder="Date Desired (ex. 4/16-4/25)">
<input type="text" rows="10" cols="100" class="form-control form-white" id="message" name="message" placeholder="More Info">
<button type="submit" class="btn btn-submit">Submit</button>
<div id="success"></div>
</form>
</div>
这是 JS。
<?php
// check if fields passed are empty
if(empty($_POST['name']) ||
empty($_POST['phone']) ||
empty($_POST['email']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$message = "Name: " . $_POST['name'];
$message .= "\r\nPhone " . $_POST['phone'];
$message .= "\r\nEmail: " . $_POST['email'];
$message .= "\r\nRequested Form of Contact: " . $_POST['reach'];
$message .= "\r\nEvent Type: " . $_POST['event'];
$message .= "\r\nRequested Dates: " . $_POST['date'];
$message .= "\r\nNumber of Attendees: " . $_POST['attendees'];
$message .= "\r\nOvernight Guests: " . $_POST['overnight'];
$message .= "\r\nMeals Included?: " . $_POST['meals'];
$message .= "\r\nAdditional Information: " . $_POST['message'];
$to = 'fakeemailforprivacy@gmail.com';
$email_subject = "Wahnee Events Inquiry";
$email_body = $message;
$headers = "From: inquiry@wahneeevents.com\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?>
是的,它是通过我的 HTML(JS 文件)链接的
虽然不太确定问题出在哪里,因为它适用于旧的联系表格,我只是复制并粘贴它...嗯。
尝试改变
<button type="submit" class="btn btn-submit">Submit</button>
到
<button action="submit" class="btn btn-submit">Submit</button>
这里真的很奇怪...希望其他人也能看起来...谢谢。
这是我正在使用的HTML:
<div id="contactform">
<form name="sentMessage" id="contactForm" novalidate action="" class="popup-form">
<input type="text" class="form-control form-white" id="name" name="name" placeholder="Full Name">
<input type="text" class="form-control form-white" id="phone" name="phone" placeholder="Email Address">
<input type="text" class="form-control form-white" id="email" name="email" placeholder="Phone Number">
<input type="text" class="form-control form-white" id="reach" name="reach" placeholder="Best Form of Contact">
<input type="text" class="form-control form-white" id="attendees" name="attendees" placeholder="Number of Guests">
<input type="text" id="overnight" name="overnight" class="form-control form-white" placeholder="Number of Overnight Guests">
<input type="text" class="form-control form-white" id="event" name="event" placeholder="Type of Event">
<input type="text" class="form-control form-white" id="meals" name="meals" placeholder="Meals included?">
<input type="text" class="form-control form-white" id="date" name="date" placeholder="Date Desired (ex. 4/16-4/25)">
<input type="text" rows="10" cols="100" class="form-control form-white" id="message" name="message" placeholder="More Info">
<button type="submit" class="btn btn-submit">Submit</button>
<div id="success"></div>
</form>
</div>
这是 JS。
<?php
// check if fields passed are empty
if(empty($_POST['name']) ||
empty($_POST['phone']) ||
empty($_POST['email']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$message = "Name: " . $_POST['name'];
$message .= "\r\nPhone " . $_POST['phone'];
$message .= "\r\nEmail: " . $_POST['email'];
$message .= "\r\nRequested Form of Contact: " . $_POST['reach'];
$message .= "\r\nEvent Type: " . $_POST['event'];
$message .= "\r\nRequested Dates: " . $_POST['date'];
$message .= "\r\nNumber of Attendees: " . $_POST['attendees'];
$message .= "\r\nOvernight Guests: " . $_POST['overnight'];
$message .= "\r\nMeals Included?: " . $_POST['meals'];
$message .= "\r\nAdditional Information: " . $_POST['message'];
$to = 'fakeemailforprivacy@gmail.com';
$email_subject = "Wahnee Events Inquiry";
$email_body = $message;
$headers = "From: inquiry@wahneeevents.com\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?>
是的,它是通过我的 HTML(JS 文件)链接的 虽然不太确定问题出在哪里,因为它适用于旧的联系表格,我只是复制并粘贴它...嗯。
尝试改变
<button type="submit" class="btn btn-submit">Submit</button>
到
<button action="submit" class="btn btn-submit">Submit</button>