“PHP邮件功能在”之后不起作用;从「;添加了标题

“PHP邮件功能在”之后不起作用;从「;添加了标题,php,html,email,Php,Html,Email,我正在使用php标题发送电子邮件 $to = 'test@email.com'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $message = '<h1>Test</h1>'; mail($to, $subject, $message, $headers); 有什么想法吗?可能你在试图欺骗

我正在使用php标题发送电子邮件

$to = 'test@email.com';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$message = '<h1>Test</h1>';

mail($to, $subject, $message, $headers);

有什么想法吗?

可能你在试图欺骗电子邮件,所以失败了

在使用mail()时,继续使用回复来自将是一个很好的练习


但是,我个人建议您使用SMTP而不是mail()或PHPMailer。

它必须具有
。“\r\n”
在结尾处,请尝试使用From first、MIME和content type更改条目的顺序。
$headers .= "From: from@address.com";
$headers .= "From: from@address.com\r\n";
$headers .= "Reply-To: from@address.com\r\n";