为什么我的D2009 exe会生成带有名为ATTnnnn.DAT的附件的电子邮件 [英] why does my D2009 exe produce emails with attachments named ATTnnnnn.DAT

查看:575
本文介绍了为什么我的D2009 exe会生成带有名为ATTnnnn.DAT的附件的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么当D2007中编译的相同源代码生成具有正确名称为原始文件名的附件的电子邮件时,为什么我的D2009 exe会生成名为ATTnnnnn.DAT的附件的电子邮件?

Why does my D2009 exe produce emails with attachments named ATTnnnnn.DAT when the same source code compiled in D2007 produces emails with attachments correctly named with the original file name?

我正在使用D2007和D2009附带的各个Indy库。在附件上没有原始文件名可防止用户双击附件打开它(通常附件是Excel电子表格)。

I am using the respective Indy libraries that come with D2007 and D2009. Not having the original file name on the attachment prevents users from being able to double click the attachment to open it (typically attachments are Excel spreadsheets).

注意:代码是一样的 - 只是编译器和Indy库有所不同。 D2009 exe发送的附件可以保存并重新命名为zzzz.xls,然后正确打开,即电子邮件和附件正确执行 - 只是电子邮件附件文件名被搞砸了。

Note: code is identical - just the compiler and Indy libraries vary. The attachment sent by the D2009 exe can be saved and renamed to say zzzz.xls and then opens correctly -- ie the email and attachment go through correctly -- it is just the email attachment file name that is messed up.

有人建议附件标题已损坏。 Indy被打破了吗复制的代码是可以在许多网站上找到的库存标准代码,但是如果需要,我可以发布。 Thx提前。

Someone suggested the attachment headers are corrupted. Has Indy been broken? The code to reproduce is stock standard code that can be found on many websites, but I can post if necessary. Thx in advance.

推荐答案

我发现问题 - 请参阅adug.com.au邮件列表中确切的
解决方案的细节,但总而言之,与D2009(版本10.2.5)
的Indy的版本在
中的IdMessageClient.pas单元中有2个错误,两行设置名称=和文件名=在附件部分处理
(一个行号是1222从内存,另一个是前几行;
抱歉我现在在家里,我今天晚上修复了工作)。缺少这些分号会导致附件标题格式错误,并且Outlook会为附件生成一个自己的名称。

I have found the problem - please see the adug.com.au mailing list for exact details of the solution, but in summary -- the version of Indy that comes with D2009 (version 10.2.5) has 2 errors in the IdMessageClient.pas unit in two lines that set the name= and filename= in the attachment part processing (one line number is 1222 from memory and the other is a few lines earlier; sorry I am at home now; I fixed things this evening at work). The lack of these semi-colons causes the attachment header to be badly formed and Outlook generates a name of its own for the attachment.

修复是输出半字符,在输出name =或
filename =令牌之前,冒号(;)。那么Indy需要重建。

The fix is to output a semi-colon ( ; ) before outputting the name= or filename= tokens. Then Indy needs to be rebuilt.

我比较了D2007
版本的Indy(10.1.5),可以看到它总是将分号放在
的内容类型行,因此避免了与D2009一起包含的
的问题。

I compared the D2007 version of Indy (10.1.5) and can see it always puts the semi-colon at the end of the Content-Type line thus avoiding the problem that has crept into the version included with D2009.

这篇关于为什么我的D2009 exe会生成带有名为ATTnnnn.DAT的附件的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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