我创建了一个简单的 html5 表单,我使用 php 邮件功能将表单邮寄到我的 gmail 帐户,但在提交该表单后我没有收到任何邮件。我没有使用任何在互联网上的本地主机。需要一些解决方案的家伙
index.html <----- Contact Form ------>
<form action="mail.php" method="POST">
<input type="text" name="username" id="one" class="form-input" placeholder="Name">
<input type="text" name="phone" id="two" class="form-input" placeholder="Mobile Number">
<input type="text" name="email" id="three" class="form-input" placeholder="Email Address">
<select class="form-input" id="four" name="place">
<option value="volvo">Centers</option>
<option value="volvo">India</option>
<option value="saab">USA</option>
<option value="mercedes">Singapore</option>
<option value="audi">China</option>
<option value="audi">Pakistan</option>
</select>
<div class="submit">
<input type="submit" name="submit" class="submit-btn">
</div>
</form>
mail.php <------ mail function written here ------>
<?PHP
$sender = $_POST['email'];
$recipient = 'jhon@gmail.com';
$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;
if (mail($recipient, $subject, $message, $headers))
{
echo "Message accepted";
}
else
{
echo "Error: Message not accepted";
}
?>