【发布时间】:2015-05-22 23:09:25
【问题描述】:
我正在开发一个 IMAP 客户端,并针对 Microsoft Exchange 服务器对其进行测试。当我选择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 是某种虚拟邮箱,但这种行为对我来说没有意义——如果不可能FETCH 服务器返回UID SEARCH 中的消息uid,为什么?有没有办法获取这些消息,或者使用 IMAP 以某种方式操纵它们?
更新:升级到 2010 SP3 后,Exchange 服务器似乎改变了主意。现在它至少返回一些响应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.=
【问题讨论】:
-
服务器说 13 EXISTS,所以 FETCH 1:13 (ENVELOPE...) 应该返回一些东西。但是 UID FETCH 90 也应该如此。我真的只是在建议一种方法来绕过服务器错误。
标签: exchange-server imap