在 Outlook 加载项中处理数字 ID/签名

发布于 2024-08-27 16:38:10 字数 563 浏览 10 评论 0原文

我有一个 C# Outlook 加载项应用程序(VS2005 和 2003 Outlook),它读取传入的电子邮件并删除附件和电子邮件文本正文以供将来处理。有时我会收到一封包含数字签名的电子邮件。当我尝试访问 mailitem.body 属性时,应用程序将失败,并引发以下异常:

System.Runtime.InteropServices.COMException (0xAB404001):操作失败。 在 Microsoft.Office.Interop.Outlook._MailItem.get_Body() 在 MyLib.MyApp.OutlookAddin.MailProcessor.ProcessMailItem(MailItem mailItem)

我很确定这是导致问题的数字签名,因为如果我将电子邮件转发回自己,它将删除原始发件人的数字签名和附加信息在应用程序中将毫无问题地处理电子邮件。我不知道该怎么办。我需要处理该电子邮件,所以我不能忽略它。以某种方式获取原始电子邮件的正文而不引发异常将是理想的选择。或者我想如果我可以识别出与电子邮件相关的数字签名,我可以将电子邮件转发给自己,但这似乎有点混乱。有人有任何建议/修复吗?感谢您的任何帮助。

I have a C# Outlook Add-In application (VS2005 and 2003 Outlook) that reads incoming emails and strips out the attachments and the email text body for future processing. Occasionally I'll get an email that contains a digital signature. The application will fail when I try to access the mailitem.body property, throwing the following exception:

System.Runtime.InteropServices.COMException (0xAB404001): The operation failed.
at Microsoft.Office.Interop.Outlook._MailItem.get_Body()
at MyLib.MyApp.OutlookAddin.MailProcessor.ProcessMailItem(MailItem mailItem)

I'm pretty sure it is the digital signature causing the problem because if I forward the email back to myself, it will strip off the original sender's digital signature and the add-in application will process the email without any problems. I'm not sure what to do. I need to process the email, so I can't just ignore it. Somehow getting the body of the original email without throwing an exception would be ideal. Or I guess if I can identify that there is a digital signature associated with the email, I could forward the email to myself, but that seems a little messy. Does anyone have any suggestions/fixes? Thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请远离我 2024-09-03 16:38:10

后续行动。我最终所做的是将 get_body 调用放入 try..catch 块中。如果出现错误,我会将电子邮件移至另一个 Outlook 文件夹以进行手动处理。以下是我在 Microsoft 论坛上发布的问题以及我收到的回复的链接。 http://social. msdn.microsoft.com/Forums/en-US/vsto/thread/d8b29cff-7656-4440-920a-21047c1ff82f

A followup. What I ended up doing was throwing the get_body call in a try..catch block. If there was an error, I moved the email to another Outlook folder for manual processing. Here is a link to the question that I posted on Microsoft's forum and a response that I received. http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/d8b29cff-7656-4440-920a-21047c1ff82f

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文