我想用php发送邮件。我已经从SMTP端口和邮件中删除了注释,但是Apache在第5行中抛出了未定义的变量$ header。这里有什么问题?
<?php include "head.php";?>
<?php
$from= "[email protected]";
$Headers = "";
$header .= "MIME-Version: 1.0 \r\n";
$header .= "Content-type: text/html; Charset= iso-859-1 \r\n";
$header .= "From: ".$from." \r\n";
$to = "[email protected]";
$subject = "test-mail";
$message ="<h1>hello</h1>";
$mail = mail($to, $subject, $message, $header);
echo (int)$mail;
?>
<?php include "foot.php";?>
已宣布$头=“”串;但是使用$ headers – Exprator
它实际上是$ header,因此不管大小写如何,它都不匹配。 – Devon
使$ Headers成为$标头。 –