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

查看:15
本文介绍了为什么我的 D2009 exe 会生成带有名为 ATTnnnnn.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.

有人建议附件标头已损坏.印地被破坏了吗?要复制的代码是可以在许多网站上找到的标准代码,但如果需要,我可以发布.提前谢谢.

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 邮件列表以了解确切信息解决方案的详细信息,但总而言之——Indy 的版本使用 D2009(版本 10.2.5)在 IdMessageClient.pas 单元中有 2 个错误在附件部分处理中设置 name= 和 filename= 的两行(一个行号是内存中的 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= 或之前输出分号 ( ; )文件名=令牌.然后印地需要重建.

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) 并且可以看到它总是将分号放在Content-Type 行的末尾,从而避免了已经潜入的问题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 会生成带有名为 ATTnnnnn.DAT 附件的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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