PHP警告:mail():发现多个或格式错误的换行符

时间:2019-06-17 15:57:06

标签: php header

我们的主机在新服务器上升级了PHP,之后我开始收到此错误(PHP警告:mail():在/ home / ucmin34 / public_html / store / secure / checkout中的Additional_header中发现多个或格式错误的换行.php(第505行)

我知道它与标题有关,但我没有编写原始代码,只是试图找出最快的修复方法,以便在下订单后使电子邮件流通。任何帮助都会很棒。

function sendHTMLemail($HTML,$plain,$from,$to,$subject)
{
$headers = "From: $from\r\n"; 
$headers .= "MIME-Version: 1.0\r\n"; 
$boundary = uniqid("HTMLEMAIL"); 
$headers .= "Content-Type: multipart/alternative;".
            "boundary = $boundary\r\n\r\n"; 
$headers .= "This is a MIME encoded message.\r\n\r\n"; 
$headers .= "--$boundary\r\n".
            "Content-Type: text/plain; charset=ISO-8859-1\r\n".
            "Content-Transfer-Encoding: base64\r\n\r\n";                
$headers .= chunk_split(base64_encode($plain)); 
$headers .= "--$boundary\r\n".
            "Content-Type: text/html; charset=ISO-8859-1\r\n".
            "Content-Transfer-Encoding: base64\r\n\r\n";       
$headers .= chunk_split(base64_encode($HTML)); 
return mail($to,$subject,"",$headers);
}
function prettyAddress($fname,$lname,$addr1,$addr2,$city,$state,$zip,$country)
{
$out = ucwords($fname." ".$lname)."<br>".ucwords($addr1)."<br>";
if($addr2)
    $out .= ucwords($addr2)."<br>";
$out .= ucwords($city.", ".$state." ".$zip)."<br>".$country;
return $out;  
}
?>

0 个答案:

没有答案