php - PHP mail() 拒绝发送,看看
问题描述
我在选项卡下创建了表单来收集用户的故事、诗歌和作者或鼓励的话,并使用 mail() 将数据发送到我的电子邮件,但它不起作用看看我的代码。
<div id="Story" class="tabcontent">
<form action="done.php" method="POST">
<input type="hidden" name="category" value="story">
<input type="hidden" name="story" value="word">
<textarea name="story" required="required" minlength="12" placeholder="Story" required="required"></textarea>
<br>
<div class="desc">maximum of 100 words</div>
<br>
<button type="submit" name="send" class="btn">send</button>
</form>
</div>
<div id="peom" class="tabcontent">
<form action="done.php" method="POST">
<input type="hidden" name="category" value="short peom">
<input type="hidden" name="peom" value="word">
<textarea name="peom" required="required" minlength="12" placeholder="short poem" required="required"></textarea>
<br>
<div class="field">
<input type="text" name="author" placeholder="author" required="required">
</div>
<div class="desc">maximum of 100 words</div>
<br>
<button type="submit" name="send" class="btn">send</button>
</form>
</div>
<div id="encouragement" class="tabcontent">
<form action="done.php" method="POST">
<input type="hidden" name="category" value="short word">
<input type="hidden" name="short" value="word">
<div class="field">
<input type="text" name="encouragement" placeholder="words of encouragement" required="required">
</div>
<div class="desc">maximum of 20 words</div>
<br>
<button type="submit" name="send" class="btn">send</button>
</form>
</div>
<!--
php.done file below
-->
done.
<?php
if(isset($_POST['submit'])){
$story = $_POST['story'];
$peom = $_POST['peom'];
$author = $_POST['author'];
$encouragement = $_POST['encouragement'];
$email_from = 'website123@gmail.com';
$email_subject = "creditentials";
$email_body = "story is; $story \n, peom is; $peom. and author is; $author \n, words of encouragement is; $encouragement ";
$to = "123@gmail.com";
$headers = "From: $email_from \r\n";
mail($to,$email_subject,$email_body,$headers);
}
?>
解决方案
推荐阅读
- javascript - 使用 UWP 应用中的通知导航到特定页面
- python - 读取文件夹中的所有文本文件并更改字符串中的字符(如果出现)
- mysql - 修复错误 1241 操作数应包含 1 列
- ios - Plotly.js 在渲染大型数据集时会阻塞 UI。它有任何下采样功能吗?
- postgresql - PostgreSQL:在数字之前对字母进行排序
- c# - ASP.NET 4.6 和 Core 之间的路由差异
- html - 在 Safari 中禁用平铺背景平滑
- jquery - 每次触发切换时,如何从 z-index 中减去 -1?
- ruby-on-rails - ActiveRecord - 如何在保存所有对象之前将(未保存)父级的(未保存)子级与另一个对象关联
- xcode - 删除脚本文件在Xcode中删除另一个