-1

我对 php 邮件生成器有疑问。我不明白我的代码将 $visitor_email 放入消息中......你能帮帮我吗?

id = $_POST['ID'];
$tt = $_POST['TT'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];

//Validate first
if(empty($id)||empty($tt)||empty($visitor_email)) 
{
    echo "ID, TT and email are required!";
    exit;
}

if(IsInjected($visitor_email))
{
    echo "Wrong email!";
    exit;
}

$email_from = 'xxx@mymail.com';//<== update the email address
$email_subject = "Something in title";
$email_body = "$message".

$to = "$visitor_email";//<== update the email address
$headers = "From: $email_from \r\n";
//Send the email!
mail($to, $email_subject, $email_body, $headers);
//done. redirect to thank-you page.
header('Location: end-page.html');
4

1 回答 1

0

更换在 $message 之后加上; . 将连接变量。

$email_body = $message;
于 2018-04-08T11:44:35.770 回答