开发者

\r\n Not Working in text email coding?

开发者 https://www.devze.com 2023-04-09 18:54 出处:网络
I am sending an email which attaches a pdf. This is the code: $mpdf->WriteHTML($html); $content = $mpdf->Output(\'\', \'S\');

I am sending an email which attaches a pdf.

This is the code:

 $mpdf->WriteHTML($html);
 $content = $mpdf->Output('', 'S');
 $content = chunk_split(base64_encode($content));
 $mailto = $email;
 $from_name = $yourname;
 $from_mail = $fromwho;
 $replyto = $replyto;
 $uid = md5(uniqid(time())); 
 $subject = 'Horse Details';
 $message = 'Please find attached details about the horse medical treatment.';
 $filename = 'Horse';
 $header = "From: ".$from_name." <".$from_mail.">\r\n";
 $header .= "Reply-To: ".$replyto."\r\n";
 $header .= "MIME-Version: 1.0\r\n";
 $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
 $header .= "This is a multi-part message in MIME format.\r\n";
 $header .= "--".$uid."\r\n";
 $header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
 $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
 $header .= $message."\r\n\r\n";
 $header .= "--".$uid."\r\n";
 $header .= "Content-Type: application/pdf; name=\"".$filename."\"\r\n";
 $header .= "Content-Transfer-Encoding: base64\r\n";
 $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
 $header .= $content."\r\n\r\n";
 $header .= "--".$uid."--";

I would like to add more details in the message and use \r\r for new paragraphs etc.

But for some rea开发者_Python百科son the \r\r or \n will not work? Suspect it is because of some of the header info but not sure which one? Had a bit of a play but could not work it out.

Can you see the problem?

Thank you.


well i don't seem to get it wrong when i sent it , here's the source of the sent message

Subject: Horse Details From: elibyy Reply-To: test@test.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="660d0865650c12fa07c8430814690009"

This is a multi-part message in MIME format. --660d0865650c12fa07c8430814690009 Content-type:text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit

Please find attached details about the horse medical treatment.

--660d0865650c12fa07c8430814690009 Content-Type: application/pdf; name="Horse" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Horse"

--660d0865650c12fa07c8430814690009--

Please find attached details about the horse medical treatment.

0

精彩评论

暂无评论...
验证码 换一张
取 消