2014-10-22 101 views
0

我需要您的帮助!使用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); 

我希望你能帮助我,谢谢!

回答

2

电子邮件需要使用内联样式,内容大致如下:

<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> 
内的有关部分

的电子邮件。

我不知道为什么你不把邮件作为邮件()函数的第三个参数。无论如何,你将需要玩其内容。