问题描述
我有一个Web应用程序,该应用程序可以使用FPDF构建动态PDF,并允许您下载它.很好.当我尝试将其发送给自己作为测试而不是下载时,我会收到带有损坏的PDF附件的电子邮件.
我已经尝试了 http://www.astahost.com/info.php/create-email-email-pdf-file-39on-fly39-php_t6334.html 和
有人遇到过这个问题还是知道一种修复方法?
推荐答案
在这里获得帮助的最佳方法是 subset 全文标题和接收到的消息的主体,然后将它们放在您的问题中.电子邮件是编码的,并非所有电子邮件服务器都通过所有类型的编码.您正在使用的代码指定" content-transfer-insoding:base64".
这是一个有效的JPG,编码相同:
--_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 ....
问题描述
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.
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?
推荐答案
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".
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 ....