英文:
JavaMail AuthenticationFailedException IMAP4 access not allowed
问题
我在尝试连接服务器时遇到身份验证错误。我正在使用JavaMail版本1.6.2,当我连接到收件箱时,它给我返回此错误。提供者使用STARTTLS与端口143进行通信。
javax.mail.AuthenticationFailedException: IMAP4 access not allowed
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732)
at javax.mail.Service.connect(Service.java:388)
at javax.mail.Service.connect(Service.java:246)
at javax.mail.Service.connect(Service.java:267)
at it.app.test.TestSendEmail.main(TestEmail.java:113)
properties.put("mail.store.protocol", "imap");
properties.put("mail.host", "in.alice.it");
properties.put("mail.user", "user_name@alice.it");
properties.put("mail.from", "address_mail@alice.it");
properties.put("mail.imap.host", "in.alice.it");
properties.put("mail.imap.port", "143");
properties.put("mail.imap.user", "user_name@alice.it");
properties.put("mail.imap.starttls.enable", "true");
properties.put("mail.imap.starttls.required", "true");
properties.put("mail.debug", "true");
properties.put("mail.debug.auth", "true");
Authenticator auth = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(account.getUsername(), account.getPassword());
}
};
session = Session.getInstance(properties, auth);
final Store store = session.getStore("imap");
store.connect(account.getUsername(), account.getPassword());
英文:
I have an authentication error when I try to connect on server. I am using JavaMail ver. 1.6.2 and it gives me this error when I connect to INBOX.
The provider use the STARTTLS for comunication with port 143
javax.mail.AuthenticationFailedException: IMAP4 access not allowed
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732)
at javax.mail.Service.connect(Service.java:388)
at javax.mail.Service.connect(Service.java:246)
at javax.mail.Service.connect(Service.java:267)
at it.app.test.TestSendEmail.main(TestEmail.java:113)
properties.put("mail.store.protocol", "imap");
properties.put("mail.host", "in.alice.it");
properties.put("mail.user", "user_name@alice.it");
properties.put("mail.from", "address_mail@alice.it");
properties.put("mail.imap.host", "in.alice.it");
properties.put("mail.imap.port", "143");
properties.put("mail.imap.user", "user_name@alice.it");
properties.put("mail.imap.starttls.enable", "true");
properties.put("mail.imap.starttls.required", "true");
properties.put("mail.debug", "true");
properties.put("mail.debug.auth", "true");
Authenticator auth = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(account.getUsername(), account.getPassword());
}
};
session = Session.getInstance(properties, auth);
final Store store = session.getStore("imap");
store.connect(account.getUsername(), account.getPassword());
. . .
DEBUG: JavaMail version 1.6.2
javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle]
DEBUG IMAP: closeFoldersOnStoreFailure
DEBUG IMAP: trying to connect to host "in.alice.it", port 143, isSSL false
OK IMAP4 Server
A0 CAPABILITY
CAPABILITY IMAP4rev1 UIDPLUS NAMESPACE QUOTA STARTTLS AUTH=PLAIN ID MOVE SORT SORT=DISPLAY THREAD=ORDEREDSUBJECT THREAD=PARTICIPANTS THREAD=REFERENCES X-FIRSTLINE X-THREAD
A0 OK CAPABILITY completed
DEBUG IMAP: AUTH: PLAIN
DEBUG IMAP: protocolConnect login, host=in.alice.it, user=user_name@alice.it, password=<non-null>
A1 AUTHENTICATE PLAIN
+
ABCDEF123==
A1 NO IMAP4 access not allowed
DEBUG IMAP: trying to connect to host "in.alice.it", port 143, isSSL false
OK IMAP4 Server
B0 CAPABILITY
CAPABILITY IMAP4rev1 UIDPLUS NAMESPACE QUOTA STARTTLS AUTH=PLAIN ID MOVE SORT SORT=DISPLAY THREAD=ORDEREDSUBJECT THREAD=PARTICIPANTS THREAD=REFERENCES X-FIRSTLINE X-THREAD
B0 OK CAPABILITY completed
DEBUG IMAP: AUTH: PLAIN
DEBUG IMAP: protocolConnect login, host=in.alice.it, user=user_name@alice.it, password=<non-null>
B1 AUTHENTICATE PLAIN
+
ABCDEF123==
B1 NO IMAP4 access not allowed
答案1
得分: 1
您的IMAP服务器拒绝了该用户的访问,请查看响应中的部分,其中显示A1 NO IMAP4 access not allowed
,这是对登录尝试的响应。您只能在(IMAP)服务器端修复此问题。
英文:
Your IMAP server is denying this user access, see the part where it says A1 NO IMAP4 access not allowed
in response to the login attempt. You can fix this only on the (IMAP) server-side.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论