我在mail()函数中收到错误。
PHP Warning: mail(): Multiple or malformed newlines found in additional_header
当我在谷歌上搜索时,我遇到了some suggestions。但删除additional_headers中的多个新行不起作用。我该如何解决这个问题?
$separate =md5(time());
$el=PHP_EOL;
$headers = "From: ".$sndr.$el;
$headers .= "Reply-To: ".$sndr.$el;
$headers .= "MIME-Version: 1.0".$el;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separate."\"".$el;
$headers .= "Content-Transfer-Encoding: 7bit".$el;
$headers .= "This is a MIME encoded message.".$el;
$headers .= "--".$separate.$el;
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$el;
$headers .= "Content-Transfer-Encoding: 8bit".$el;
$headers .= $message.$el;
答案 0 :(得分:1)
您已将邮件插入标题:
$headers .= $message.$el;
所以你有
From: someone@somewhere.com
blah: blah
Hi mom!
Content-type: blah blah
这是一封非法电子邮件。