我正在使用 PHP 电子邮件脚本作为联系表格。表单有六个字段:
- 姓名
- 电子邮件
- 电话号码
- 预定日期
- 预订时间
- 评论
还有一个隐藏的robotest蜜罐场。PHP脚本如下:
<?php
$robotest = $_POST['robotest']; //just testin' for robots
$recipient = "info@mydomain.com"; //recipient
$email = ($_POST['email']); //senders e-mail adress
if((filter_var($email, FILTER_VALIDATE_EMAIL)) && ($robotest == "")) {
$Name = ($_POST['name']); //senders name
$mail_body = !!!----> WHAT DO I PUT HERE <----!!!!
$subject = "Porter Inquiry"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
mail($recipient, $subject, $mail_body, $header); //mail command :)
} else {
print "You've entered an invalid email address!";
}
?>
您会在上面注意到,我在哪里放置!!!----> WHAT DO I PUT HERE <----!!!
,我不确定如何将多个字段放入邮件正文。我想包括以下内容:
"Hello,
You have received a new booking with the following details:
Booking Time: ($_POST['time']) Booking Date: ($_POST['date'])
Additional customer comments: ($_POST['comments']);
Please respond to the customer within 30 minutes on the following
phone number: ($_POST['phone'])
Warm regards,
Robot."
我找不到任何关于如何成功实现这一目标的信息,非常感谢一些指导。