LocalHost:没有收到使用PHP发送电子邮件的表单

时间:2017-07-27 17:22:10

标签: java php html css

我的问题是我收到了email_success.php页面,但当我去查看我的电子邮件时,那里什么都没有。我正在使用LocalHost USBWebServer V8。任何帮助都会赞赏!` 这是html联系表:

<html xslms="http: //www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html: charset-UTF-8">
<title>Contact Form</title>
</head>

<body>
<h1>Contact Form</h1>
<form action="thankyou.php" method="post">
    Name <input type="text" name="fullname"><br>
    Email <input type="text" name="email"><br>
    Message <textarea name="message" cols="30" rows="10"></textarea><br>
    <input type="submit" value="Submit">





</body>
</html>

这是针对thankyou.php和email_success.php页面的php:

<?php


$name = $_POST['fullname'];
$email = $_POST['email'];
$message = $_POST['message'];

$email_message = "

Name: ".$name."
Email: ".$email."
Message: ".$message."
";


mail ('ENTERYOUREMAILHERE@gmail.com', 'New inquiry', $email_message);
header("Location: email_success.php");



?>

************************************************
<html xslms="http: //www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html: charset-UTF-8">
<title>Contact Form</title>
</head>

<body>
<h1>Email Sent</h1>
<p> Yippee! Your email has been sent </p>

</body>
</html>

1 个答案:

答案 0 :(得分:0)

好吧,使用本地服务器会限制您的一些福利,例如发送电子邮件的能力,因为它没有附带 SMTP 服务器。现在,假设您的代码没有错误,您可以尝试使用一些在本地模拟此类活动的工具,例如 Test Mail Server Tool。我目前在我的机器上使用它来测试邮件活动,例如与 WAMP 服务器 配对发送联系表格、验证码和重置密码,所以我不确定它是否适用于 USBWebServer< /strong>(尝试时告诉我)。