<?php
// code goes here
$to = ""; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$name = $_POST['name'];
$one = $_POST['one'];
$two = $_POST['two'];
$three = $_POST['three'];
$four = $_POST['four'];
$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message = $name . " " . $one . " " . $two . " " . $three . " " . $four . " " . "\n\n" . $_POST['message'];
$message2 = "Here is a copy of your message " . $name . "\n\n" . $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Thankyou for your feedback " . $name;
?>
电子邮件: 名称 (可选) :
我对公司向客户执行任务的方式非常满意。
非常同意同意中立不同意强烈反对
您对公司服务的满意程度如何?
完全没有满意的满足感到满意非常满意的高兴
您多久使用一次我们的服务?
每年一次每周每周每月每2至3个月不要使用
p&gt; 根据您对我们服务的认识,它是更好,相同还是更差 其他公司?
好多了更好的关于同样更糟糕的更糟糕
答案 0 :(得分:0)
让我们尝试使用此功能发送它:
<强> back.php 强>
以下是一些输入数据:
$to = $_POST['to'];
$subject = $_POST['subj'];
$message = $_POST['message'];
$from = 'robot@' . $_SERVER['HTTP_HOST'];
这是功能:
function send_mail($to, $from, $subject, $message) {
$headers = ['From: ' . $from, 'Reply-To: ' . $from, 'X-Mailer: PHP/' . phpversion()]
return mail($to, $subject, $message, implode("\r\n", $headers));
}
以下是它的使用方法:
send_mail($to, $from, $subject, $message);
<强>的index.html 强> 这是表格:
<form action="back.php" method="post">
<input type="text" placeholder="To" name="to">
<input type="text" placeholder="Subject" name="subj">
<textarea name="message"></textarea>
<input type="submit" value="Send">
</form>