mailkit imap 验证失败

mailkit imap Authenticate failed

Connected to imap://mail.xxxxx.com:143/?starttls=when-available
S: * OK The Microsoft Exchange IMAP4 service is ready.
C: A00000000 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 LOGINDISABLED STARTTLS UIDPLUS CHILDREN IDLE NAMESPACE LITERAL+
S: A00000000 OK CAPABILITY completed.
C: A00000001 STARTTLS
S: A00000001 OK Begin TLS negotiation now.
C: A00000002 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN UIDPLUS CHILDREN IDLE NAMESPACE LITERAL+
S: A00000002 OK CAPABILITY completed.
C: A00000003 AUTHENTICATE NTLM
S: +
C: TlRMTVNTUAABAAAABwIIAAAAAAAgAAAAAAAAACAAAAA=
S: + TlRMTVNTUAACAAAACAAIADgAAAAFAokCQ1Oy6n0KV+wAAAAAAAAAAJAAkABAAAAABgGxHQAAAA9DAE8AUgBQAAIACABDAE8AUgBQAAEABABBAEQABAAeAGMAbwByAHAALgB3AG8AcwBpAGcAbgAuAGMAbwBtAAMAJABhAGQALgBjAG8AcgBwAC4AdwBvAHMAaQBnAG4ALgBjAG8AbQAFAB4AYwBvAHIAcAAuAHcAbwBzAGkAZwBuAC4AYwBvAG0ABwAIAEgKvfK4E9IBAAAAAA==
C: TlRMTVNTUAADAAAAGAAYAGgAAAAYABgAgAAAAAAAAABIAAAAIAAgAEgAAAAAAAAAaAAAAAAAAACYAAAAAYIIAgoAWikAAAAPYwBtAHMAMQA1AEAAdwBvAHMAaQBnAG4ALgBjAG8AbQBIi1QHDf/aHwAAAAAAAAAAAAAAAAAAAAClb/du5aSYbtWcPg24wC4ZDwe68ixMp2g=
S: A00000003 NO AUTHENTICATE failed.
C: A00000004 AUTHENTICATE PLAIN
S: +
C: XXXXXXXXXXXXX
S: A00000004 NO AUTHENTICATE failed.
C: A00000005 LOGIN xxxx xxxx
S: A00000005 NO LOGIN failed.

NTLM 身份验证在当前版本的 MailKit 1.6.0 中不起作用(嗯,它适用于 一些 服务器,但显然不适用于其他服务器)。

根据 https://github.com/jstedfast/MailKit/issues/397,我最近提交的一个补丁理论上会解决这个问题,但我没有收到提交错误的人的回复以确认它有效。

您可以从 GitHub 下载的源代码进行编译,也可以等待下一个版本。

同时,您可以像这样禁用 NTLM 身份验证:

client.AuthenticationMechanisms.Remove ("NTLM");

在调用 Authenticate() 之前进行此调用。