我最近为我的客户创建了一个报价单,但没有收到任何电子邮件。
我的get-a-quote.html
:
<form action="process.php" method="post">
<div class="top_contact">
<div class="row">
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>First Name*<br/><input type="text" required></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>Last Name*<br/><input type="text" required></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>Email Address*<br/><input type="email" required></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>Phone*<br/><input type="text" required></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>Address<br/><input type="text" ></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>City<br/><input type="text" ></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>State<br/><input type="text" ></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>Zip<br/><input type="text" ></p>
</div>
</div>
</div>
<div class="bottom_details">
<h3>MOVE DETAILS</h3>
<div class="row">
<div class="col-md-7 col-lg-7 col-sm-12 col-xs-12">
<p>Requested move date *<br/><input type="text" required></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>moving from zip *<br/><input type="text" required></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>describe the location *<br/><input type="text" required></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>moving to zip *<br/><input type="text" required></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>describe the location *<br/><input type="text" required></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>type of residence<br/><input type="text" ></p>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">
<p>storage requested ?<br/><input type="text" ></p>
</div>
</div>
<button type="submit">GET A QUATE</button>
</div>
</form>
和我的process.php
<div class="thank_page margin-bottom-100">
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="thank_box">
<?php
if(isset($_POST['submit'])){
$to = "dovariramu@gmail.com"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$first_name = $_POST['name'];
$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message2,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
// You cannot use header and echo together. It's one or the other.
}
?>
<br>
<a href="index.html"><i class="fa fa-arrow-left"></i>Go to Home page</a>
</div>
</div>
</div>
</div>
</div>
有人可以帮助我,解释为什么我没有收到此报价单中的电子邮件吗?
答案 0 :(得分:0)
出于这些目的,您可能需要设置电子邮件服务器设置。 检查以下链接以使用PHP发送电子邮件 https://github.com/PHPMailer/PHPMailer