我在我的網站上寫了代碼聯繫我們的頁面,但它不工作。我檢查了一切,但仍然沒有收到電子郵件,當我嘗試我的自我。
聯繫我們頁面腳本不起作用
我有這個形式:
<form id="contact-form" class="cform" method="post">
<label class="hide"
for="author">
Full Name
</label>
<input class="input-fields" id="full_name" name="full_name" type="text" required="required" placeholder="Full Name" value=""/>
<label class="hide" for="email">Email</label>
<input class="input-fields req-email" id="email" name="email" type="text" required="required" placeholder="Email Address" value=""/>
<label class="hide" for="subject_title">Subject title</label>
<input class="input-fields" id="subject_title" name="subject_title" type="text" required="required" placeholder="Subject Title" value=""/>
<label class="hide" for="comment">Message</label>
<textarea id="comment" class="input-fields form-control" required placeholder="Message" name="comment" cols="40" rows="200"></textarea>
<input name="submit" type="submit" id="submit-contact-info" class="contact-info-submit form-submit-button span2" value="Send message">
</form>
這是php:
<?php
if(isset($_POST['submit'])){
$to = "[email protected]"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$full_name = $_POST['full_name'];
$subject = $_POST['subject_title'];
$subject2 = "Copy of your form submission";
$message = $full_name . " wrote the following:" . "\n\n" . $_POST['comment'];
$message2 = "Here is a copy of your message " . $full_name . "\n\n" . $_POST['comment'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
$msgss= "Mail Sent. Thank you " . $full_name . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>
它目前做些什麼?是否引發錯誤?你有一個郵件服務器設置? – MLeFevre 2014-10-20 10:41:20
'error_reporting(E_ALL); ini_set('display_errors',1);' – 2014-10-20 10:42:47
沒有error.it顯示消息「Mail Sent。Thank you,'發送人姓名',我們會盡快與您聯繫。 ,但是當我檢查我的收件箱時,沒有收到電子郵件。 – 2014-10-20 10:43:40