MailKit:IMAP服务器回复了' EXAMINE'命令与'BAD'响应

时间:2016-10-10 12:37:35

标签: mailkit

我在Exchange 2007邮箱上收到此错误。我看到它返回了来自MailKit抛出的错误的BAD响应:

The IMAP server replied to the 'EXAMINE' command with a 'BAD' response.

但这并没有告诉我足够的细节。所以我正在运行协议日志记录,从中可以看出问题所在。它说:

K00000005 BAD Duplicate folders "Conversation Action Settings", "News Feed", "Quick Step Settings", "Suggested Contacts" were detected in the mailbox. Therefore the user's connection was disconnected.

我想获取此错误文本并将其显示给用户,以便他们可以修复他们的邮箱(他们可以通过删除重复的文件夹来做,假设他们知道他们是哪个)。有没有一种简单的方法来获得完整的回复文本?

完整协议日志如下:

S: * OK Microsoft Exchange Server 2007 IMAP4 service ready
C: K00000000 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN IDLE NAMESPACE LITERAL+
S: K00000000 OK CAPABILITY completed.
C: K00000001 AUTHENTICATE NTLM
...
S: K00000001 OK AUTHENTICATE completed.
C: K00000002 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN IDLE NAMESPACE LITERAL+
S: K00000002 OK CAPABILITY completed.
C: K00000003 NAMESPACE
S: * NAMESPACE (("" "/")) NIL NIL
S: K00000003 OK NAMESPACE completed.
C: K00000004 LIST "" "INBOX"
S: * LIST (\Marked \HasNoChildren) "/" INBOX
S: K00000004 OK LIST completed.
C: K00000005 EXAMINE INBOX
S: K00000005 BAD Duplicate folders "Conversation Action Settings", "News Feed", "Quick Step Settings", "Suggested Contacts" were detected in the mailbox. Therefore the user's connection was disconnected.
S: * BYE Connection is closed. 15

1 个答案:

答案 0 :(得分:0)

您可以尝试解析ImapCommandException.Message属性,以获取'之后的文字:'异常消息中使用的字符。

我还刚刚向ResponseText添加了ImapCommandException属性,因此如果您想使用MailKit内置源,您可以获取此文本,而无需解析它。