Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 30098

PHP Mail - Multiple or malformed newlines found

$
0
0

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.

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

Viewing all articles
Browse latest Browse all 30098

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>