按照指南http://htmldog.com/techniques/formtoemail/,我通过php' mail()'函数表单脚本提交了多个表单(我通过 php从contact.php文件中发送了表单数据-S本地主机:8000 )
在终端中使用“ postq ”命令(我运行的是MacOS HighSierra),我收到了以下列表,这些列表似乎(根据到达时间)对我而言意味着电子邮件已成功发送至我的gmail帐户,但在gmail收件箱/垃圾邮件中找不到:
[Andrews-MacBook-Pro]: ~/coding/website_projects/building-beyond$ mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
1939320164C6A9* 527 Mon Aug 20 14:17:17 andrew@Andrews-MacBook-Pro.local
denikeandrew@gmail.com
1039220164C69F* 503 Mon Aug 20 16:39:54 andrew@Andrews-MacBook-Pro.local
denikeandrew@aol.com
3158C20164C7E3* 373 Mon Aug 20 19:35:38 andrew@Andrews-MacBook-Pro.local
denikeandrew@gmail.com
12EC920164C6A2* 526 Mon Aug 20 16:40:31 andrew@Andrews-MacBook-Pro.local
denikeandrew@aol.com
这基于以下contact.php文件:
<!-- contact.php -->
<?php
if($_POST["submit"]) {
$recipient="denikeandrew@gmail.com";
$subject="Form to email message";
$sender=$_POST["sender"];
$senderEmail=$_POST["senderEmail"];
$senderPhone=$_POST["senderPhone"];
$message=$_POST["message"];
$mailBody="Name: $sender\nEmail: $senderEmail\nPhone: $senderPhone\n\n$message";
mail($recipient, $subject, $mailBody, "From: $sender <$senderEmail>");
$thankYou="<p>Thank you! Your message has been sent.</p>";
}
?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/png" href="images/bbfavicon.png"/>
<link href="./css/bbwp.css" rel="stylesheet" type="text/css">
<title>Building & Beyond</title>
</head>
<body>
<header>
<img id="logo" src="images/BB White Logo.jpg">
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="portfolio.html">Portfolio</a></li>
<li class="current"><a href="contact.php">Contact</a></li>
</ul>
</nav>
</header>
<section id="contactInfo">
<div class="middleContainer">
<?=$thankYou ?>
<div id="emailform">
<h1>Email Us</h1>
<form method="post" action="contact.php">
<div>
<label>Name</label><br>
<input name="sender" type="text" placeholder="Name">
</div>
<div>
<label>Email</label><br>
<input name = "senderEmail" type="email" placeholder="Email Address">
</div>
<div>
<label>Phone</label><br>
<input name="senderPhone" type="phone" placeholder="Phone Number">
</div>
<div>
<label>Message</label><br>
<textarea name="message" placeholder="Message"></textarea>
</div>
<input type="submit" name="submit" value="Submit">
</form>
</div>
</div>
</section>
</body>
</html>
究竟是什么原因阻止电子邮件同时出现在我的gmail / aol帐户中?