Exchange 日历文件夹中的幻影邮件

Phantom messages in Exchange Calendar folder

我正在开发 IMAP 客户端,并针对 Microsoft Exchange 服务器对其进行测试。当我select到Calendar邮箱时,UID SEARCH提示邮箱里有邮件,但是UID FETCH取不到:

S: * OK The Microsoft Exchange IMAP4 service is ready.
...
C: 38 SELECT "Calendar"
S: * 13 EXISTS
S: * 0 RECENT
S: * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
S: * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
S: * OK [UIDVALIDITY 37122] UIDVALIDITY value
S: * OK [UIDNEXT 190] The next unique identifier value
S: 38 OK [READ-WRITE] SELECT completed.
C: 39 UID SEARCH OR UNSEEN FLAGGED
C: 40 UID SEARCH SEEN UNFLAGGED SINCE 19-Oct-2014
S: * SEARCH
S: 39 OK SEARCH completed.
S: * SEARCH 90 183
S: 40 OK SEARCH completed.
C: 41 UID FETCH 90,183 (ENVELOPE INTERNALDATE FLAGS BODY.PEEK[])
S: 41 OK FETCH completed.

我假设 Calendar 是某种虚拟邮箱,但这种行为对我来说没有意义 — 为什么服务器 return UID SEARCH 中的邮件 uid 如果不可能 FETCH 他们?有没有什么方法可以获取这些消息,或者使用 IMAP 以某种方式操纵它们?


更新: 升级到2010 SP3后,Exchange服务器似乎变心了。现在它至少 return 响应 FETCH 命令:

C: 120 UID FETCH 773,948 (ENVELOPE INTERNALDATE FLAGS BODY.PEEK[])
S: * 16 FETCH (ENVELOPE (NIL "Retrieval using the IMAP4 protocol failed for the following message: 773" (("Microsoft Exchange Server 2010" NIL NIL ".MISSING-HOST-NAME.")) NIL NIL (("██████████" NIL "██████████" "██████████")) NIL NIL NIL NIL) INTERNALDATE "05-Mar-2015 17:22:02 +0000" FLAGS (\Seen) BODY[] {783}
S: <783 bytes omitted>
S:  UID 773)
S: * 17 FETCH (ENVELOPE (NIL "Retrieval using the IMAP4 protocol failed for the following message: 948" (("Microsoft Exchange Server 2010" NIL NIL ".MISSING-HOST-NAME.")) NIL NIL (("██████████" NIL "██████████" "██████████")) NIL NIL NIL NIL) INTERNALDATE "11-Mar-2015 17:56:04 +0000" FLAGS (\Seen) BODY[] {747}
S: <747 bytes omitted>
S:  UID 948)
S: 120 OK FETCH completed.

消息如下所示:

MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
From: Microsoft Exchange Server 2010
To: ███████████ <████████@██████████.com>
Subject: Retrieval using the IMAP4 protocol failed for the following
 message: 773
Content-Transfer-Encoding: quoted-printable

The server couldn't retrieve the following message:

Subject: "████ █████ ███████ ██ ████ ███ █████ ███████.. ███ ███ ██████ ███=
██!"
From: "███████████  ██████████" ("/O=3D████████/OU=3D████████ █████████████=
█ █████ (███████████████)/CN=3D██████████/CN=3D███████████  █████████████")
Sent date: 3/5/2015 5:22:02 PM

The message hasn't been deleted. You might be able to view it using either =
Outlook or Outlook Web App. You can also contact the sender to find out wha=
t the message says.=

听起来像是服务器错误。 Exchange "implaments IMAP" 为了能够在评估投标时勾选所需的复选框,这已经不是什么秘密了。您还会在其中看到其他错误。

获取该邮箱据称包含的所有 UID 的列表,并尝试逐个获取它们以查看至少其中一些 return 是否有一些可用值可能会很有趣。但是,考虑到这是一个名为 "Calendar" 的邮箱,很可能它只是一些随机的 Exchange 数据导出,只有通过 MAPI 才有意义。随机谷歌搜索结果 https://technet.microsoft.com/en-us/library/aa998606%28v=exchg.150%29.aspx 这表明 Exchange 可以配置为以各种格式提供这些日历数据。也许你的服务器是 "misconfigured".

TL;DR:是 Exchange。别浪费时间了。