我尝试设置email.html和action.php,以便有人可以从网站发送电子邮件.这是email.html中的代码
<form action="./action.php" method="post">
<p>Your Name</p>
<p><input type="text" name="name" /></p>
<p>Email</p>
<p><input type="text" name="email" /></p>
<p>Services</p>
<p><input type="text" name="service" /></p>
<p>Requests</p>
<p><textarea rows="8" cols="32" name="comment"></textarea></p>
<p><input type="submit" value="Send" /></p>
</form>
Run Code Online (Sandbox Code Playgroud)
在action.php我有
<?php
$to = "foo@outlook.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "foo2@gmail.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
Run Code Online (Sandbox Code Playgroud)
在email.html中输入的信息成功加载到action.php中,但我的Outlook收件箱中没有从电子邮件方法收到任何内容.我错过了什么吗?
| 归档时间: |
|
| 查看次数: |
23925 次 |
| 最近记录: |