0
我想獲得一個簡單的聯繫表單與我的wordpress網站一起工作,但無法讓它工作。我不想使用任何插件,我只是想用PHP來做。所以我把這個文件在我的WordPress安裝的根目錄,在我的HostGator的託管網站如何發送電子郵件與Wordpress頁面上的聯繫表格
www.example.com/sendmail.php
<?php
if(isset($_POST['submit'])){
$to = "[email protected]";
$from= $_POST['email'];
$fname= $_POST['fname'];
$lname= $_POST['lname'];
$message= $_POST['message'];
$subject = "Request email";
$headers = "From:" .$from;
mail($to,$subject,$message,$headers);
}
?>
這是接觸美國形成在www.example.com /聯繫我們
<form action="http://www.example.com/sendmail.php" method="post">
<fieldset>
<div class="form-group">
<div class="col-md-12">
<input id="fname" name="name" type="text" placeholder="First Name" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input id="lname" name="name" type="text" placeholder="Last Name" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input id="email" name="email" type="text" placeholder="Email Address" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input id="phone" name="phone" type="text" placeholder="Phone" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<textarea class="form-control" id="message" name="message" placeholder="Enter your massage for us here. We will get back to you within 2 business days." rows="7"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-12 text-center">
<!-- <button type="submit" class="btn btn-primary btn-lg">Submit</button>-->
<input type="submit" name="submit" class="btn btn-primary btn-lg" value="Submit">
</div>
</div>
</fieldset>
</form>
如果我嘗試訪問此頁面www.example.com/sendmail.php,它會給200成功確定消息。但是,如果我嘗試填寫表單然後發送電子郵件,我無法接收它。
有什麼我失蹤或我需要檢查?