为什么我的 D2009 exe 会生成带有名为 ATTnnnnn.DAT 的附件的电子邮件
为什么我的 D2009 exe 会生成带有名为 ATTnnnnn.DAT 的附件的电子邮件,而在 D2007 中编译的相同源代码会生成带有正确命名为原始文件名的附件的电子邮件?
我正在使用 D2007 和 D2009 附带的相应 Indy 库。 附件中没有原始文件名会导致用户无法双击附件将其打开(附件通常是 Excel 电子表格)。
注意:代码是相同的 - 只是编译器和 Indy 库有所不同。 D2009 exe 发送的附件可以保存并重命名为 zzzz.xls,然后可以正确打开 - 即电子邮件和附件正确通过 - 只是电子邮件附件文件名被搞乱了。
有人建议附件标头已损坏。 印地已经被打破了吗? 要复制的代码是可以在许多网站上找到的库存标准代码,但如果需要,我可以发布。 提前谢谢。
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?
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).
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我建议更新到当前的 Tiburon 快照 (http://indy.fulgan.com/ZIP)。 Indy版本现在是10.5.7。
I recommend updating to the current Tiburon snapshot (http://indy.fulgan.com/ZIP). The Indy version is 10.5.7 now.
恐怕您可能只需要追踪 indy 代码即可。 Indy 过去曾出现过许多错误,因此这可能就是原因。 如果你追踪的话,你应该很快就能找到它。
I'm afraid you might just need to trace down into the indy code. Indy has had a number of bugs in the past so this might be the cause. If you trace in you should find it pretty quickly.
IdAttachment.Filename 属性是否已设置? 在 Indy 版本之间,他们可能改变了 Filename 的工作方式。
Has the IdAttachment.Filename property been set? It's possible that between the Indy versions they changed the way that Filename works.
理查德的建议对我很有效。 我比较了正确附件和 Indy 的消息来源。 将分号放在 Content-type 和 Content-disposition 后面(确实在第 1220 行左右,并且它有效。谢谢理查德!
The recommendations of Richard worked for me. I compared the message sources of a correct attachment and that of Indy. Put the semicolons behind Content-type and Content-disposition (around line 1220 indeed, and it works. Thank you Richard!
我发现了问题 - 请参阅 adug.com.au 邮件列表了解确切信息
解决方案的细节,但总而言之——即将推出的 Indy 版本
D2009(版本 10.2.5)的 IdMessageClient.pas 单元中有 2 个错误
在附件部分处理中设置 name= 和 filename= 的两行
(内存中的一个行号是 1222,另一个是早几行;
抱歉,我现在在家; 我今晚在工作中修好了东西)。 缺少这些分号会导致附件标头格式错误,并且 Outlook 会为附件生成自己的名称。
修复方法是在输出 name= 或之前输出分号 (;)
文件名=标记。 那么印地需要重建。
我对比了D2007
Indy 版本(10.1.5),可以看到它总是将分号放在
Content-Type 行的末尾,从而避免了已经出现的问题
D2009 附带的版本。
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.
The fix is to output a semi-colon ( ; ) before outputting the name= or
filename= tokens. Then Indy needs to be rebuilt.
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.