gpt4 book ai didi

java - 为什么我无法使用 JavaMail(IMAP 协议(protocol))连接到我的邮箱并收到 NO AUTHENTICATE failed 错误?

转载 作者:行者123 更新时间:2023-11-30 01:49:29 25 4
gpt4 key购买 nike

我正在尝试通过 JavaMail IMAP 协议(protocol)连接到邮箱,但无法成功连接。

  1. telnet成功
  2. 能够使用相同的凭据配置 Outlook Web 客户端
  3. 尝试使用最新的 JavaMail 版本 1.6.2(JDK7 版本)
  4. 也尝试设置以下属性:mail.imap.auth.plain.disable=true
Properties props = System.getProperties();
props .setProperty("mail.store.protocol", "imap");
props .setProperty("mail.debug.auth", "true");
props .setProperty("mail.imap.ssl.enable", "true");
props .setProperty("mail.imap.auth.plain.disable", "true");
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(UserName, Password);
}
});
session.setDebug(true);
store = session.getStore("imap");
store.connect(ServerName, Port, UserName, Password);
DEBUG: setDebug: JavaMail version 1.6.2
DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle]
DEBUG IMAP: mail.imap.fetchsize: 16384
DEBUG IMAP: mail.imap.ignorebodystructuresize: false
DEBUG IMAP: mail.imap.statuscachetimeout: 1000
DEBUG IMAP: mail.imap.appendbuffersize: -1
DEBUG IMAP: mail.imap.minidletime: 10
DEBUG IMAP: closeFoldersOnStoreFailure
2019-06-12 20:10:11 imap : Before connect
DEBUG IMAP: trying to connect to host "<mail-server>", port 993, isSSL true
* OK The Microsoft Exchange IMAP4 service is ready.
A0 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=NTLM AUTH=GSSAPI SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
A0 OK CAPABILITY completed.
DEBUG IMAP: AUTH: PLAIN
DEBUG IMAP: AUTH: NTLM
DEBUG IMAP: AUTH: GSSAPI
DEBUG IMAP: protocolConnect login, host=<mail-server>, user=username, password=<non-null>
DEBUG IMAP: mechanism PLAIN disabled by property: mail.imap.auth.plain.disable
DEBUG IMAP: mechanism LOGIN not supported by server
A1 AUTHENTICATE NTLM
+
DEBUG NTLM: type 1 message: 4E 53 50 00 01 00 00 00 03 A2 00 00 00 00 00 00 2F 00 00 00 0F 00 0F 00
<NTLMSSL encoded data>
A1 NO AUTHENTICATE failed.
DEBUG IMAP: trying to connect to host "<mail-server>", port 993, isSSL true
* OK The Microsoft Exchange IMAP4 service is ready.
B0 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=NTLM AUTH=GSSAPI SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
B0 OK CAPABILITY completed.
DEBUG IMAP: AUTH: PLAIN
DEBUG IMAP: AUTH: NTLM
DEBUG IMAP: AUTH: GSSAPI
DEBUG IMAP: protocolConnect login, host=<mail-server>, user=username, password=<non-null>
DEBUG IMAP: mechanism PLAIN disabled by property: mail.imap.auth.plain.disable
DEBUG IMAP: mechanism LOGIN not supported by server
B1 AUTHENTICATE NTLM
+
DEBUG NTLM: type 1 message: 4E 54 4C 53 45 4F 4C 56 41 44 53 52 56 30 39 31
<NTLMSSL encoded data>
B1 NO AUTHENTICATE failed.
javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732)
at javax.mail.Service.connect(Service.java:388)
at com.maildebug.MailDebugUtil.Pop3_IMAP(MailDebugUtil.java:131)
at com.maildebug.MailDebugUtil.main(MailDebugUtil.java:67)

最佳答案

您几乎肯定遇到了 Exchange 服务器错误,它宣称它支持 PLAIN 身份验证,但实际上并不支持。

调试输出没有显示您已禁用 PLAIN 身份验证,也许您在设置该属性时出现了问题?您能否包含您实际使用的代码来显示您如何设置该属性?

另请注意,您don't need the Authenticator .

关于java - 为什么我无法使用 JavaMail(IMAP 协议(protocol))连接到我的邮箱并收到 NO AUTHENTICATE failed 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56565096/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com