由FPDF和PHP生成的PDF电子邮件附件损坏 [英] Corrupt PDF email attachment when generated by FPDF and PHP

查看:93
本文介绍了由FPDF和PHP生成的PDF电子邮件附件损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,可以使用FPDF构建动态PDF并允许您下载它.很好当我尝试通过电子邮件将其发送给自己作为测试而不是下载时,我收到的电子邮件中包含损坏的PDF附件.

I have a web application that builds a dynamic PDF with FPDF and allows you to download it. That works fine. When I try to email it to myself as a test instead of downloading, I get an email with a corrupt PDF attachment.

我已经尝试过 http://www.astahost.com/info.php/create-email-pdf-file-39on-fly39-php_t6334.html

I have tried the code from http://www.astahost.com/info.php/create-email-pdf-file-39on-fly39-php_t6334.html and http://www.daniweb.com/code/snippet217105.html but get the same result each time.

有人遇到这个问题或知道一种解决方法吗?

Has anyone come across this or know a way to fix it?

推荐答案

在这里获得帮助的最佳方法是子集接收到的邮件的全文标题和正文,然后将它们放在您的问题.电子邮件已被编码,并且并非所有电子邮件服务器都通过所有类型的编码.您使用的代码指定"Content-Transfer-Encoding:base64".

Your best way to get help here is to subset the full text headers and body of a received message, and place them in your question. Email is encoded, and not all email servers pass all types of encoding. The code you're using specifies "Content-Transfer-Encoding: base64".

以下是使用相同的有效JPG编码:

Here's a valid JPG encoded with same:

--_eba07140-496e-4f3d-91ce-aff8afde8879_
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="DSC03538_AZ_atCape.JPG"

/9j/4Rt/RXhpZgAASUkqAAgAAAALAA4BAgAgAAAAkgAAAA8BAgAFAAAAsgAAABABAgAHAAAAuAAA
ABIBAwABAAAAAQAAABoBBQABAAAAwAAAABsBBQABAAAAyAAAACgBAwABAAAAAgAAADIBAgAUAAAA
....

这篇关于由FPDF和PHP生成的PDF电子邮件附件损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆