我有一个html表单,我想通过电子邮件将其数据发送到指定的电子邮件地址。尽管尝试了各种方法,但从未收到过电子邮件。我希望有人可以看看并纠正错误。
我尝试更改发送和接收电子邮件地址,使其与域匹配,但无济于事。谁能找到问题所在?
<?php
if($_POST["submit"]) {
$recipient="info@website-with-the-form.co.uk";
$subject="Quote request";
$sender=$_POST["sender"];
$senderEmail=$_POST["senderEmail"];
$message=$_POST["message"];
$location=$_POST["location"];
$planning=$_POST["planning"];
$number=$_POST["number"];
$mailBody="
Hello, \n
You have a new quote request \n\n
Name: $sender \n
Job Description: $message \n\n
Location: $location \n
Planning Approved: $planning \n
Phone: $number \n
Email: $senderEmail \n\n
End of message
";
mail($recipient, $subject, $mailBody, "From: Info <info@website-with-the-form.co.uk.co.uk>");
$thankYou="<p>Thank you! Your request has been received and the team will reply shortly.</p>";
}
?>
<?=$thankYou ?>
<form method="post" action="/">
<div class="wrap-input validate-input" data-validate="Name is required">
<span class="label-input">Your Name</span><br>
<input type="text" name="sender" placeholder="Enter your name">
</div>
<div class="wrap-input validate-input" data-validate="Email is required">
<span class="label-input">Your Email</span><br>
<input type="text" name="senderEmail" placeholder="Enter your email">
</div>
<div class="wrap-input validate-input" data-validate="Phone Number is required">
<span class="label-input">Your Phone Number</span><br>
<input type="text" name="number" placeholder="Enter your phone number">
</div>
<div class="wrap-input validate-input">
<span class="label-input">Job Location</span><br>
<input type="text" name="location" placeholder="Enter job location">
</div>
<div class="wrap-input validate-input" data-validate = "Message is required">
<span class="label-input">Description of Job</span><br>
<textarea name="message" placeholder="Your message here..."></textarea>
</div>
<div class="wrap-input input-select">
<span class="label-input">Planning Approved?</span><br>
<select class="selection-2" name="planning">
<option>Yes</option>
<option>No</option>
</select>
<span class="focus-input"></span>
</div>
<input type="submit" value="Submit">
<br>
<br>
</form>