PHP邮件 - 找到多个或格式不正确的换行符 [英] PHP Mail - Multiple or malformed newlines found

查看:1145
本文介绍了PHP邮件 - 找到多个或格式不正确的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们升级了我们的PHP版本,现在收到错误警告:mail():在additional_header中找到多个或格式不正确的换行符。

we upgraded our version of PHP and are now getting the error " Warning: mail(): Multiple or malformed newlines found in additional_header".

尝试不同的东西,但没有得到任何工作。我很抱歉,因为我不是很熟悉所有这些工作,所以请忍受我。

I've created experimenting with different things but haven't gotten anything to work. I apologize as I'm not very familiar with how all of this works, so please bear with me.

目标(在早期版本中有效)是发送一个基于HTML的消息(有,
标签等),其中包含我们的PDF附件服务器。

The objective (which worked in earlier versions) is to send an HTML based message (has ,
tags, etc) that includes a PDF attachment that exists on our server.

如果您能给我具体的调整,我会非常感激!

If you can give me specific adjustments, I'd appreciate it greatly!

$sFrom = "[Company Name] <[Our Email]>";
$sReplyTo = "[Our Email]";
$sParams = "-f [Our Email]";
$attachment = chunk_split(base64_encode(file_get_contents($sPath)));
$uid = md5(uniqid(time()));

$sHeaders = "From: ".$sFrom."\n".
            "Reply-To: ".$sReplyTo."\n".
            "MIME-Version: 1.0\n".
            "Content-Type: multipart/mixed; boundary=\"".$uid."\"\n\n".
            "This is a multi-part message in MIME format.\n".
            "--".$uid."\n".
            "Content-Type: text/html; charset='iso-8859-1'\n".
            "Content-Transfer-Encoding: 7bit\n\n".
            $sMessage."\n\n".
            "--".$uid."\n".
            "Content-Type: application/pdf; name=\"".$sFileName."\"\n".
            "Content-Transfer-Encoding: base64\n".
            "Content-Disposition: attachment; filename=\"".$sFileName."\"\n\n".
            $attachment."\n\n".
            "--".$uid."--";    
if (!mail($sTo, $sSubject, "", $sHeaders, $sParams)) {
    $bError = true;
}


推荐答案

尝试使用 \\\\\
而不是 \\\

这篇关于PHP邮件 - 找到多个或格式不正确的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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