C# - 邮件确认 Outlook

C# - Mail confirmation Outlook

我正在开发一个应用程序来检查 Outlook 邮件帐户,找到所有附件,然后将它们打印出来。此时,分析的邮件被移动到另一个文件夹。

我只有一个问题:有时,我会收到一些带有阅读确认的邮件。该应用程序检查附件,当它必须移动邮件时,它会冻结。然后在Outlook中弹出一个关于发送或不发送阅读确认的弹窗。

现在,我想以编程方式进行此操作,我总是想在请求时发送阅读确认。

我找到了一个属性(ReadReceiptRequested),如果有阅读确认要发送,设置为true,但我不知道怎么发送。

这是我使用的一段代码:

//I store all the emails in a List<Outlook.MailItem> named emails
Outlook.Application myApp = new Outlook.Application();
Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
//Check if the mail has read confirmation
if (emails[right_index].ReadReceiptRequested)
{
    //How to send read confirmation?
}
//I read the mail, then I move it to another folder
emails[indice_scelto].UnRead = false;
emails[indice_scelto].Move(mapiNameSpace.Folders["New folder"]);

你能帮帮我吗?

提前致谢!

Outlook 对象模型不提供任何 属性 或方法。您所能做的就是设置 UnRead property to false and Save 项。

然后您可以使用指定的 Send\Receive 组使用 Start method of the SyncObject class. The Namespace class provides the SyncObjects 属性 开始同步用户的文件夹,其中 returns 包含所有 Send\Receive 的 SyncObjects 集合团体。例如:

 Public Sub Sync() 
  Dim nsp As Outlook.NameSpace 
  Dim sycs As Outlook.SyncObjects 
  Dim syc As Outlook.SyncObject 
  Dim i As Integer 
  Dim strPrompt As Integer 
  Set nsp = Application.GetNamespace("MAPI") 
  Set sycs = nsp.SyncObjects 
  For i = 1 To sycs.Count 
   Set syc = sycs.Item(i) 
   strPrompt = MsgBox( _ 
   "Do you wish to synchronize " & syc.Name &"?", vbYesNo) 
   If strPrompt = vbYes Then 
    syc.Start 
   End If 
  Next 
 End Sub

我想您可以将项目移动到任何需要的地方。

您可以在扩展 MAPI 级别(C++ 或 Delphi)执行此操作 - 调用 IMessage::SetReadFlag() - 传递 0 以发送阅读回执或 SUPPRESS_RECEIPT 否则。

If Redemption is an option (I am its author), it exposes the RDOMail.MarkRead 方法采用 SuppressReceipt 布尔参数。