JavaMail AuthenticationFailedException IMAP4访问未被允许

huangapple go评论59阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年3月7日 02:12:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/75654382.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定