我试图通过mailer.php页面在主题行中显示两个连接变量,但电子邮件中的主题行总是空白。以下是相关代码。
/* Subject and To */
$to = 'nnorman@dimplexthermal.com';
$subject = $company . ' ' . $name;
/* Gathering Data Variables */
$name = $_POST['name'];
$email = $_POST['email'];
$company = $_POST['company'];
$body = <<<EOD
<br><hr><br>
Email: $email <br>
Name: $name <br>
Company: $company <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($to, $subject, $body, $headers);
答案 0 :(得分:4)
$to = 'nnorman@dimplexthermal.com';
$subject = $company . ' ' . $name;
/* Gathering Data Variables */
$name = $_POST['name'];
$email = $_POST['email'];
$company = $_POST['company'];
您在$company
$name
和$subject
之后才开始设置/* Gathering Data Variables */
$name = $_POST['name'];
$email = $_POST['email'];
$company = $_POST['company'];
$to = 'nnorman@dimplexthermal.com';
$subject = $company . ' ' . $name;
和{{1}}
尝试切换线条:
{{1}}