PDF附件正在更改为不可用的DAT文件 [英] PDF attachments are changing to unusable DAT files

查看:461
本文介绍了PDF附件正在更改为不可用的DAT文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内部解决方案的系统,试图将电子邮件发送给客户端。除了一个客户端获取.dat文件,而不是其他人获得的生成良好的.pdf文件,这个系统工作得很好。



我已经研究了这个问题,很多事情指向Outlook发送电子邮件(不使用outlook)和分割文件的问题,因为它是大的(不是,文件被重命名为= _utf-8_B_Q29uc29saWRhdGVkIEludm9pY2VzIGZv.dat而不是1180426.pdf。

>

这两个文件的标题只是对我来说并不意味着什么的字符行。



.dat文件:
file1

  =?utf-8?B?Y2lCQmJIQm9ZU0JKYm5OMWJHRjBhVzl1Pz0NCiA9P3V0Zi04P0I / SUNZ?= \ 
\

=?utf-8?B?Z1YyRjBaWEp3Y205dlptbHVaeUF0SUVGc2NHaGhJRWx1YzNWc1lYUnBi?= \
\

=?utf-8?B?MjRnSmlCWFlYUmw / PQ0KID0 / dXRmLTg / Qj9jbkJ5YjI5bWFXNW5JT0tB?= \
\

=?utf-8?B?a3lCVmJtbDJaWEp6WVd3Z1EybDBlU3dnS0RJd01USXRNRFF0TVRNcD89?= \
\
=?utf- 8?B?DQogPT91dGYtOD9CP0xuQmtaZz09Pz0 =?=
Co ntent-Transfer-Encoding:base64
内容处理:附件

file2

  =?utf-8?B?YUdFZ1NXNXpkV3hoZEdsdmJpQW1JRmRoPz0NCiA9P3V0Zi04P0I / ZEdW?= \ 
\

= ?utf-8?B?eWNISnZiMlpwYm1jZ0xTQkJiSEJvWVNCSmJuTjFiR0YwYVc5dUlDWWdW?= \
\

=?utf-8?B?MkYwWlhKd2NtOXY / PQ0KID0 / dXRmLTg / Qj9abWx1WnlEaWdKTWdWVzVw?= \
\\ \\

=?utf-8?B?ZG1WeWMyRnNJRU5wZEhrc0lDZ3lNREV5TFRBMExURXpLUzV3WkdZPT89?= \
\
=?utf-8?B ?? =
内容转移-Encoding:base64
内容处理:附件

有没有人知道为什么这样正在发生?

解决方案

从评论中:



有一个奇怪Unicode字符被打印,而不是文字中的连字符:...防水 - 通用城市...。这可能是某人的邮件服务器对非ASCII字符敏感,并将其编码为base64作为结果。将其更改为常规的ASCII连字符,这应该是正常的。






我如何找到它:



首先,我使用的是在线base64解码器: http: /www.opinionatedgeek.com/dotnet/tools/base64decode/



其次,我从标题中连接所有的base64字符串开始。它分为多个段:对于第一个标题,有5个段。分段是问号之间的长部分。把它们放在一起,你会得到:

  Y2lCQmJIQm9ZU0JKYm5OMWJHRjBhVzl1Pz0NCiA9P3V0Zi04P0I / SUNZ 
Z1YyRjBaWEp3Y205dlptbHVaeUF0SUVGc2NHaGhJRWx1YzNWc1lYUnBi
MjRnSmlCWFlYUmw / PQ0KID0 / dXRmLTg / Qj9jbkJ5YjI5bWFXNW5JT0tB
a3lCVmJtbDJaWEp6WVd3Z1EybDBlU3dnS0RJd01USXRNRFF0TVRNcD89
DQogPT91dGYtOD9CP0xuQmtaZz09Pz0 =

将其放入解码器中给出: p>

  ciBBbHBoYSBJbnN1bGF0aW9u?= 
=?utf-8?B?ICYgV2F0ZXJwcm9vZmluZyAtIEFscGhhIEluc3VsYXRpb24gJiBXYXRl?=
=?utf-8? B?cnByb29maW5nIOKAkyBVbml2ZXJzYWwgQ2l0eSwgKDIwMTItMDQtMTMp?=
=?utf-8?B?LnBkZg ==?=

另一组base64段。第一个段看起来像是被截断,所以我认为进入文件名的是其中的一部分。所以,我与和预置它得到:

  Q29uc29saWRhdGVkIEludm9pY2VzIGZvciBBbHBoYSBJbnN1bGF0aW9u 
ICYgV2F0ZXJwcm9vZmluZyAtIEFscGhhIEluc3VsYXRpb24gJiBXYXRl
cnByb29maW5nIOKAkyBVbml2ZXJzYWwgQ2l0eSwgKDIwMTItMDQtMTMp
LnBkZg = =

这个放入解码器将使它吐出一个.bin文件因为非ASCII字符。 bin文件包含PDF的完整文件名。



在十六进制编辑器中打开bin文件:

  43 6F 6E 73 6F 6C 69 64 61 74 65 64 20 49 6E 76综合投资
6F 69 63 65 73 20 66 6F 72 20 41 6C 70 68 61 20 * ***
49 6E 73 75 6C 61 74 69 6F 6E 20 26 20 57 61 74 **********& ***
65 72 70 72 6F 6F 66 69 6E 67 20 2D 20 41 6C 70 ********** - ***
68 61 20 49 6E 73 75 6C 61 74 69 6F 6E 20 26 20 ** **********&
57 61 74 65 72 70 72 6F 6F 66 69 6E 67 20 E2 80 *************â€b $ b 93 20 55 6E 69 76 65 72 73 61 6C 20 43 69 74 79********* ****
2C 20 28 32 30 31 32 2D 30 34 2D 31 33 29 2E 70,(2012-04-13).p
64 66 df

em-dash伸出来像一个疼痛的拇指。


I have an system that is an in house solution attempting to email invoices to clients. This system works great except for one client gets .dat files instead of the nicely generated .pdf files that everyone else gets.

I have researched the problem and many things point to issues with Outlook sending emails(not using outlook) and splitting the files because it is to large(it isn't, we can manualy send the email fine.)

The files get renamed to something like "=_utf-8_B_Q29uc29saWRhdGVkIEludm9pY2VzIGZv.dat" instead of "1180426.pdf".

After the headers on both files is just lines of characters that don't mean anything to me.

the headers of the .dat files: file1

 =?utf-8?B?Y2lCQmJIQm9ZU0JKYm5OMWJHRjBhVzl1Pz0NCiA9P3V0Zi04P0I/SUNZ?=\
\

 =?utf-8?B?Z1YyRjBaWEp3Y205dlptbHVaeUF0SUVGc2NHaGhJRWx1YzNWc1lYUnBi?=\
\

 =?utf-8?B?MjRnSmlCWFlYUmw/PQ0KID0/dXRmLTg/Qj9jbkJ5YjI5bWFXNW5JT0tB?=\
\

 =?utf-8?B?a3lCVmJtbDJaWEp6WVd3Z1EybDBlU3dnS0RJd01USXRNRFF0TVRNcD89?=\
\
 =?utf-8?B?DQogPT91dGYtOD9CP0xuQmtaZz09Pz0=?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment

file2

 =?utf-8?B?YUdFZ1NXNXpkV3hoZEdsdmJpQW1JRmRoPz0NCiA9P3V0Zi04P0I/ZEdW?=\
\

 =?utf-8?B?eWNISnZiMlpwYm1jZ0xTQkJiSEJvWVNCSmJuTjFiR0YwYVc5dUlDWWdW?=\
\

 =?utf-8?B?MkYwWlhKd2NtOXY/PQ0KID0/dXRmLTg/Qj9abWx1WnlEaWdKTWdWVzVw?=\
\

 =?utf-8?B?ZG1WeWMyRnNJRU5wZEhrc0lDZ3lNREV5TFRBMExURXpLUzV3WkdZPT89?=\
\
 =?utf-8?B??="
Content-Transfer-Encoding: base64
Content-Disposition: attachment

Does anyone have any idea on why this is happening?

解决方案

From the comments:

There's a weird Unicode character being printed instead of a hyphen here in the filename: "... Waterproofing – Universal City, ...". It could be that somebody's mailserver is sensitive to non-ASCII characters and is encoding it to base64 as a result. Change it to a regular ASCII hyphen and it should be fine.


How I found it:

Firstly, here's the online base64 decoder I used: http://www.opinionatedgeek.com/dotnet/tools/base64decode/

Secondly, I started by concatenating all of the base64 strings from the header. It's split up into multiple segments: for the first header, there are 5 segments. The segments are the long parts between the question marks. Putting them all together, you get:

Y2lCQmJIQm9ZU0JKYm5OMWJHRjBhVzl1Pz0NCiA9P3V0Zi04P0I/SUNZ
Z1YyRjBaWEp3Y205dlptbHVaeUF0SUVGc2NHaGhJRWx1YzNWc1lYUnBi
MjRnSmlCWFlYUmw/PQ0KID0/dXRmLTg/Qj9jbkJ5YjI5bWFXNW5JT0tB
a3lCVmJtbDJaWEp6WVd3Z1EybDBlU3dnS0RJd01USXRNRFF0TVRNcD89
DQogPT91dGYtOD9CP0xuQmtaZz09Pz0=

Putting this into the decoder gives:

ciBBbHBoYSBJbnN1bGF0aW9u?=
=?utf-8?B?ICYgV2F0ZXJwcm9vZmluZyAtIEFscGhhIEluc3VsYXRpb24gJiBXYXRl?=
=?utf-8?B?cnByb29maW5nIOKAkyBVbml2ZXJzYWwgQ2l0eSwgKDIwMTItMDQtMTMp?=
=?utf-8?B?LnBkZg==?=

Another set of base64 segments. The first segment looks like it's cut off, so I assume that what went into the filename is actually part of it. So I prepend it with that and get:

Q29uc29saWRhdGVkIEludm9pY2VzIGZvciBBbHBoYSBJbnN1bGF0aW9u
ICYgV2F0ZXJwcm9vZmluZyAtIEFscGhhIEluc3VsYXRpb24gJiBXYXRl
cnByb29maW5nIOKAkyBVbml2ZXJzYWwgQ2l0eSwgKDIwMTItMDQtMTMp
LnBkZg==

Putting this into the decoder will make it spit out a .bin file because of the non-ASCII character. The bin file contains the full filename of the PDF.

Opening the bin file in a hex editor:

43 6F 6E 73 6F 6C 69 64 61 74 65 64 20 49 6E 76   Consolidated Inv
6F 69 63 65 73 20 66 6F 72 20 41 6C 70 68 61 20   oices for **** 
49 6E 73 75 6C 61 74 69 6F 6E 20 26 20 57 61 74   ********** & ***
65 72 70 72 6F 6F 66 69 6E 67 20 2D 20 41 6C 70   ********** - ***
68 61 20 49 6E 73 75 6C 61 74 69 6F 6E 20 26 20   ** ********** & 
57 61 74 65 72 70 72 6F 6F 66 69 6E 67 20 E2 80   ************* â€
93 20 55 6E 69 76 65 72 73 61 6C 20 43 69 74 79   " ********* ****
2C 20 28 32 30 31 32 2D 30 34 2D 31 33 29 2E 70   , (2012-04-13).p
64 66                                             df

The em-dash sticks out like a sore thumb.

这篇关于PDF附件正在更改为不可用的DAT文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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