我想通过电子邮件发送给注册人的电子邮件地址。我对php不太了解,但是我想使用mail()方法向我发送电子邮件。当有人注册时,会弹出404错误,并指出:“当没有在您网站上指定名称的网页出现时,就会产生此错误。”
这只是一个登录页面,我对php的了解不多,所以我不确定要尝试什么。
<!DOCTYPE html>
<html>
<body>
<h1>AmCompare is a New App that Helps You Save Time and Money!</h1>
<div id="container">
<p id="welcome">
<b>Hello!</b><br /><br />We hope you're having an awesome day. AmCompare is an app that can instantly compare the price of a product to similar products on Amazon. All it takes is a picture, and AmCompare will find you the best deal online to
help you save money! By signing up below, you're showing interest in a product designed to help you save time and money.
<br /><br />
<b>Thanks so much,</b>
<br /> The Entire AmCompare Team
</p>
<form style="border:1px solid #ccc" method="post">
<label for="email">Email</label>
<input type="text" placeholder="Enter Email" name="email" required>
<button type="submit" class="signupbtn">
Sign Up
</button>
</form>
</div>
<div id="footer">© AmCompare 2019</div>
<script src="share.js"></script>
<br>
<?php
if(!isset($_POST['submit']))
{
echo "Error; You need to submit the form.";
}
$email = $_POST['email'];
if(empty($email)) {
echo "Email is mandatory.";
exit;
}
$email_from = '$email \n';
$email_subject = "New Form Submission";
$email_body = "New email: $email \n".
$to = "jordanpattonsnowflake@gmail.com";
$headers = "From: $email_from \r\n";
mail($to,$email_subject,$email_body,$headers);
?>
</body>
</html>