问题描述
正如标题所示,我没有使用getFolder(INBOX)的消息;昨天工作,我不认为我现在在调试时改变了任何东西我可以看到我没有消息。
public String [] [] fetchEmails()throws异常{
String [] [] emailArray;
属性props = new Properties();
会话session = Session.getDefaultInstance(props,null);
Store store = session.getStore(pop3s);
store.connect(pop.gmail.com,******@googlemail.com,********);
文件夹文件夹= store.getFolder(INBOX);
folder.open(Folder.READ_ONLY);
int howmuch = folder.getMessageCount();
消息消息[] = folder.getMessages(); // int = 0,显示出错了,消息是空数组*
...... 。
folder.close(false);
store.close();
return emailArray;
}
任何事情都可以帮助,但一直驱使我疯了!
一旦使用pop协议读取邮件,他们下载到客户端,并在pop服务器中删除一次以下语句
store.close()执行。
所以当你再次运行程序时,只会收到新的邮件(即那些以前没有通过任何流行客户端提取的邮件)
另见:
As the title says I am getting no messages using getFolder("INBOX");
It was working yesterday, I do not think I changed anything now when debugging I can see that I am getting no messages.
public String[][] fetchEmails() throws Exception {
String[][] emailArray;
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("pop3s");
store.connect("pop.gmail.com", "******@googlemail.com", "********");
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);
int howmuch = folder.getMessageCount();
Message message[] = folder.getMessages();//The int = 0, which shows something has gone wrong, message is an empty array.*
.......
folder.close(false);
store.close();
return emailArray;
}
Anything could help, but it has been driving me insane!
Once a mail read using pop protocol they downloaded to client and they get deleted in pop server once this below statement store.close() executes.So when you run the program again only the new mails are fetched(i.e., those mails which are not fetched previously through any pop client)
see also:http://en.wikipedia.org/wiki/Post_Office_Protocol#Overview
这篇关于当尝试使用JavaMail拉动POP3收件箱文件夹时,我没有收到任何电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!