簡體   English   中英

使用FPDF調整郵件中的字體和字體大小

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM