我发送了一封附有pdf的电子邮件。
这是代码:
$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."--";
我想在邮件中添加更多详细信息,并使用\ r \ n \ r \ n代替新段落等。
但由于某种原因,\ r \ n \ n或\ n将不起作用?怀疑是因为一些标题信息但不确定是哪一个?有一点戏,但无法解决。
你能看到问题吗?
谢谢。
答案 0 :(得分:0)
当我发送它时,我似乎没有弄错,这里是发送消息的来源
主题:马详情 来自:elibyy回复:test@test.org MIME-Version:1.0 Content-Type:multipart / mixed; 边界= “660d0865650c12fa07c8430814690009”
这是MIME格式的多部分邮件。 --660d0865650c12fa07c8430814690009内容类型:text / plain; charset = iso-8859-1 Content-Transfer-Encoding:7bit
请查看有关马医疗的附加详情。
- 660d0865650c12fa07c8430814690009内容类型:application / pdf; name =“Horse”Content-Transfer-Encoding:base64 Content-Disposition: 附件;文件名= “马”
- 660d0865650c12fa07c8430814690009 -
请查看有关马医疗的附加详情。