duanhuang1967 2016-06-16 14:23
浏览 36

PHPMailer PDF附件在base64中被破坏

I have some PHP code that takes in data from an HTML form, creates a PDF (using fpdf), and then e-mails the user that PDF. I am using PHPMailer to send the pdf file to the user. This all seems to work fine, with a valid PDF arriving at the specified e-mail address.

In some cases, when users have forwarded on this e-mail to a third party (it's always the same third party), the third party have been reporting the PDF is unreadable (as in corrupt). It only happens on a small number of occasions, and I can't find a common theme. The messages are sent to an Office 365 system, which will also be where messages are forwarded from.

The e-mails are normally picked up by my users on their work issues iPad, from where the message will be forwarded.

Having done some digging, I have noticed that the raw content for a message with corrupted PDF look like this (the header of the BASE64 section). The xxxxx is me.

--_005_A421FDCEF50F4B6D813D37045CFF0CBExxxxxx_
Content-Transfer-Encoding: BASE64
Content-Disposition: ATTACHMENT;
    size=1375857;
    modification-date="Thu, 16 Jun 2016 13:18:11 GMT";
    filename=xxxxx92471462.pdf;
    creation-date="Thu, 16 Jun 2016 13:18:11 GMT"
Content-Type: APPLICATION/PDF;
    name=xxxxxbe92471462.pdf
Content-Id: <8D340DC9CB8C174E97F546D602F2FD49@xxxxxx.com>

ReceivedfromDB3PR01MB0729eurprd01prodexchangelabscom101605123byDB3PR01MB0730
eurprd01prodexchangelabscom101605124withMicrosoftSMTPServerTLSid1515118viaMa
ilboxTransportSat11Jun2016103431+0000ReceivedfromDB5PR01CA0007eurprd01prodex
changelabscom10162149145byDB3PR01MB0729eurprd01prodexchangelabscom101605123w
ithMicrosoftSMTPServerTLSid1515118Sat11Jun2016103429+0000ReceivedfromDB3FFO1
1FD045protectiongbl2a01111f4007e04176byDB5PR01CA0007outlookoffice365com2a011
11e40051b717withMicrosoftSMTPServerTLSid1515178viaFrontendTransportSat11Jun2
...

It looks to me like somehow a load of mail headers have made their way into the BASE64, hence the attachment becoming mangled. Later on in the BASE64 it looks like more normal encoded attachment.

I doubt that this is really anything to do with the initial creation from PHPMailer, as the message is fine. It seems to me that something is mangling the e-mail structure and attachments somewhere further down the line.

Has anyone seen anything like this before?

Many thanks in advance for any pointers.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图