我通过联系表单向我的身份证件发送邮件,但没有在我的身份证中收到任何邮件。是的我已经上传到服务器但仍然无法正常工作,这里是代码
contact.html
<form action="contact.php" method="post">
<label class="label">Name <em>*</em></label>
<label class="input">
<input type="text" name="name" id="name">
</label>
<div class="clearfix"></div>
<label class="label">E-mail <em>*</em></label>
<label class="input">
<input type="email" name="email" id="email">
</label>
<!-- <div class="clearfix"></div>
<label class="label">Phone <em>*</em></label>
<label class="input">
<input type="text" name="phone" id="phone">
</label> -->
<div class="clearfix"></div>
<label class="label">Subject <em>*</em></label>
<label class="input">
<input type="text" name="subject" id="subject">
</label>
<div class="clearfix"></div>
<label class="label">Message <em>*</em></label>
<label class="textarea">
<textarea rows="5" name="content" id="message"></textarea>
</label>
<div class="clearfix"></div>
<button type="submit" name="submit" class="button">Send Message</button>
</form>
以下是contact.php的代码
<?php
if(isset($_POST['submit'])){
$to = "snigdhasrk143@gmail.com"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$full_name = $_POST['name'];
$subject = $_POST['subject'];
$content = $_POST['content'];
$subject2 = "Copy of your form submission";
$message = $full_name . " " . $from . " -- wrote the following:" . "\n\n" . $_POST['content'];
$message2 = "Here is a copy of your message " . $full_name . "\n\n" . $_POST['content'];
$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
header('Location: index.html');
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>
成功重定向到索引页但没有收到任何邮件?请帮忙