[英]Adjust type font and font size in mail with FPDF
我需要你的帮助!
我有一些文件会在FPDF中生成带有附件的邮件,我需要将邮件的字体系列配置为Arial和Size 12px,我知道如何在PDF中而不是在邮件中这样做。
这是FPDF邮件的代码
$filename = "example.pdf";
// encode data (puts attachment in proper format)
$pdfdoc = $pdf->Output("", "S");
$attachment = chunk_split(base64_encode($pdfdoc));
// main header (multipart mandatory)
$headers = "From: ".$from.$eol;
$headers .= "MIME-Version: 1.0".$eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol;
$headers .= "Content-Transfer-Encoding: 7bit".$eol;
$headers .= "This is a MIME encoded message.".$eol.$eol;
// message
$headers .= "--".$separator.$eol;
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
$headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$headers .= $message.$eol.$eol;
// attachment
$headers .= "--".$separator.$eol;
$headers .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol;
$headers .= "Content-Transfer-Encoding: base64".$eol;
$headers .= "Content-Disposition: attachment".$eol.$eol;
$headers .= $attachment.$eol.$eol;
$headers .= "--".$separator."--";
// send message
mail($to, $subject, "", $headers);
希望您能帮助我,谢谢!
电子邮件需要使用内联样式,包括以下几行:
<p style="font-family: Arial, sans-serif; font-size: 12px">This paragraph is formatted correctly</p>
或者您可以将样式放入
<span>Here is lots of stuff.</span>
标签覆盖了内部的相关部分
<body></body>
电子邮件。
我不确定为什么不将$ message用作mail()函数的第三个参数。 无论如何,您都需要使用其内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.