简体   繁体   English

VSTO Outlook,无法读取收件箱中的退回邮件

[英]VSTO Outlook, not able to read bounce back emails in inbox

i'm new to develop VSTO.我是开发 VSTO 的新手。

I'm trying create a function that is able to read bounce back email which located in inbox folder.我正在尝试创建一个能够读取位于收件箱文件夹中的退回电子邮件的功能。

here is my code:这是我的代码:

Outlook.MAPIFolder inbox = Globals.ThisAddIn.Application.Session.DefaultStore.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

foreach (object item in inbox.Items)
{
    Outlook.MailItem mail = item as Outlook.MailItem;
    if (mail != null)
    {
        Debug.WriteLine("Subject:" + mail.Subject);
    }
}

here is my debug output:这是我的调试输出:

在此处输入图片说明 Debug output there is only ONE email subject is "Verify your account to do more with Outlook.com"调试输出只有一个电子邮件主题是“验证您的帐户以使用 Outlook.com 执行更多操作”

在此处输入图片说明

program is not able to get bounce back email in inbox.程序无法在收件箱中退回电子邮件。

could anyone give me some suggestions to handle this problem?谁能给我一些建议来处理这个问题?

The NDRs are represented by the ReportItem Outlook object, not MailItem. NDR 由ReportItem Outlook 对象表示,而不是 MailItem。 Take a look at the live objects in Outlook with OutlookSpy (click Item button).使用OutlookSpy查看 Outlook 中的活动对象(单击“项目”按钮)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM