在Additional_header中发现了多个或格式错误的换行符 [英] Multiple or malformed newlines found in additional_header

查看:117
本文介绍了在Additional_header中发现了多个或格式错误的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的mail()函数出现错误。

I'm getting an error in my mail() function.

PHP警告:mail():在以下位置出现多个或格式错误的换行符Additional_header

我在谷歌搜索时遇到了一些建议。但是删除additional_headers中的多行新行却无效。我该如何解决?

While I was googling I came across some suggestions. but removing multiple new lines in additional_headers did not work. How can I fix this?

$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;


推荐答案

您正在将邮件插入标头中:

You're inserting your message into your headers:

$headers .= $message.$el;

所以您将拥有

From: someone@somewhere.com
blah: blah
Hi mom!
Content-type: blah blah

这是非法电子邮件。

这篇关于在Additional_header中发现了多个或格式错误的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆