我在下面有一些代码:
Properties props = System.getProperties();
//set mail protocol
//props.setProperty("mail.store.protocol", "imaps");
props.setProperty("mail.store.protocol", "pop3s");
//create new store
Session session = Session.getDefaultInstance(props);
//store = session.getStore("imaps");
store = session.getStore("pop3s");
store.connect("pop.mail.yahoo.com", 995, "MyYahooUserName", "MyPassword");
//store.connect("imap.next.mail.yahoo.com", 993, "MyYahooUserName", "MyPassword");
isConnect = true;
当我尝试 IMAP 协议时它可以工作,但是对于 POP3,我在下面遇到异常,我不知道为什么
SEVERE: null
javax.mail.AuthenticationFailedException: EOF on socket
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:208)
at javax.mail.Service.connect(Service.java:295)
at gmailutilities.GmailUtilities.connect(GmailUtilities.java:88)
at gmailutilities.Main.main(Main.java:29)
javax.mail.MessagingException: Not connected
at com.sun.mail.pop3.POP3Store.checkConnected(POP3Store.java:408)
at com.sun.mail.pop3.POP3Store.getDefaultFolder(POP3Store.java:357)
at gmailutilities.GmailUtilities.openFolder(GmailUtilities.java:103)
at gmailutilities.Main.main(Main.java:30)
*有人知道为什么吗?请帮助我。谢谢大家!*