Php 表单到电子邮件,表单未发布到我的邮件
让我们尝试使用此函数发送它:Php 表单到电子邮件,表单未发布到我的邮件,php,html,email,Php,Html,Email,让我们尝试使用此函数发送它: $to = $_POST['to']; $subject = $_POST['subj']; $message = $_POST['message']; $from = 'robot@' . $_SERVER['HTTP_HOST']; back.php 以下是一些输入数据: <?php // code goes here $to = ""; // this is your Email address $from = $_POST['ema
$to = $_POST['to'];
$subject = $_POST['subj'];
$message = $_POST['message'];
$from = 'robot@' . $_SERVER['HTTP_HOST'];
back.php
以下是一些输入数据:
<?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;
?>
以下是函数:
$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));
}
index.html
表格如下:
send_mail($to, $from, $subject, $message);
您能显示代码吗?html代码@DieterMemkenis$to
确实是空的,或者您出于隐私原因刚刚删除了该地址?您是否收到任何错误消息?我们能提供什么帮助?我删除它是为了隐私@twinfriends如果它没有帮助,请提供每个变量的var_dump。第二:检查你的目标电子邮件。第三:在你的收件箱中检查“垃圾邮件”。你能给我一个提交表单数据的代码吗?因为av做了很多,但仍然没有结果,你可以使用上面的php来指导你使用变量@Мааааааааач