email - 发送邮件 php 不在电子邮件正文中显示字段
问题描述
我面临问题发送邮件 PHP 问题我收到空白电子邮件正文电子邮件谁能帮助我做错了什么,如果有人解决我的问题,我真的很感激
我的表格代码:
<form method="post" action="/mailsend.php">
<input type="text" name="name" value="" id="name" placeholder="Your Name" >
<input type="email" name="email" value="" id ="email" placeholder="Your Email ID*" required>
</div>
<input type="text" name="phone" value="" id="phone" placeholder="Your Phone No*" required>
<input type="submit" name="submit" value="Enquire Now" class="theme-btn btn-style-one">
</form>
我的发送邮件 PHP 代码是
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['phone'];
$from = 'From: yoursite.com';
$to = 'ansarul@webmatrixindia.com';
$subject = 'Customer Inquiry';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html\r\n";
$headers .= 'From: from@example.com' . "\r\n" .
'Reply-To: reply@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
解决方案
推荐阅读
- twitter - Twitter Restful API 在查询字符串中传递计数参数时抛出 401 未经授权的错误
- node.js - 无法使用 @azure/cosmos NPM 在 QueryIterator 上调用 toArray()
- python - 在 Python 中制作(以空格分隔的)文本文件的列(或行)数组
- join - Diesel join 无法推断类型
- perl - 当我运行以“#!/usr/bin/perl -w”开头的文件时,出现错误:“第 153 行的语法错误,靠近“=~?””
- python - 如何将 Seaborn/Matlplotlib 散点图标记设置为相应的图像/照片?
- c - 丹尼斯·里奇 C 语言中的变量名
- arrays - 从我想获取名称的第一个数组和第二个索引的 2 个 foreach 数组中获取数据
- php - 全日历日期渲染
- amazon-s3 - 如何通过执行 Python Lambda 函数创建日志并导出到 S3 存储桶