繁体   English   中英

在Aol电子邮件中通过电子邮件发送pdf附件

[英]sending pdf attachment in email in Aol email

我正在通过电子邮件发送pdf附件,尝试在Aol邮件中打开时遇到问题。 附件显示为类似于电子邮件abc.pdf(<1 KB)。附件显示:

Adobe Reader无法打开“ abc.pdf”,因为它不是受支持的文件类型,或者因为文件已损坏(例如,它作为电子邮件附件发送且未正确解码)。

这是我的代码:

include("walljs/mpdf/mpdf.php");
$mpdf=new mPDF();   
$mpdf->ignore_invalid_utf8 = true;
$stylesheet = file_get_contents('appstyle_pdf.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($output);
$comname = preg_replace("/[^A-Za-z0-9]/","",$_POST['company']); 
$name = $dirname.str_replace(" ","-",$comname)."_".$time_stamp.".pdf";        
$mpdf->Output($name,"F");   

$file = $name;
$crlf = "\n";
$filename = basename($file);
$file_size = filesize($file);
$content = chunk_split(base64_encode(file_get_contents($file))); 
$uid = md5(uniqid(time()));
$header = "From: orders@enkapps.com \r\n"
      ."MIME-Version: 1.0\r\n"
      ."Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"
      ."This is a multi-part message in MIME format.\r\n" 
      ."--".$uid."\r\n"
      ."Content-type:text/plain; charset=iso-8859-1\r\n"
      ."Content-Transfer-Encoding: 7bit\r\n\r\n"
      .$message." 
      ".$companyinfo."\r\n\r\n"
      ."--".$uid."\r\n"
      ."Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"
      ."Content-Transfer-Encoding: base64\r\n"
      ."Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n"
      .$content."\r\n\r\n"
      ."--".$uid."--";

任何建议,请。

尝试在$ headers这样的字符串中定义标题:

    'Content-Type: application/pdf';
    'Content-Disposition: inline; filename="'.$filename.'"';
        'Cache-Control: private, max-age=0, must-revalidate';
    'Pragma: public';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM