JavaMail的只得到新消息 [英] JavaMail get only new messages
问题描述
我不知道是否有一种方式来获得的JavaMail只新邮件。例如,在最初的负荷,让所有在收件箱中的邮件,并存储它们。然后,每当应用程序加载一遍,只能获得新邮件,而不是再次重装这一切。
I was wondering if there was a way to get only new messages in javamail. For example, on an initial load, get all of the messages in the inbox, and store them. Then whenever the application loads again, only get the new messages instead of reloading them all again.
这是可能用JavaMail,它是如何工作的?
Is this possible with javamail, how does it work?
一点背景,我想在android系统创建一个简单的电子邮件客户端,和我有成功下载我的所有邮件的测试Java项目。
A bit of background, I'm trying to create a simple email client in android, and I have a test java project that successfully downloads all my emails.
谢谢!
推荐答案
您将需要指定一个FetchProfile,这将使信息的魔杖,你从服务器得到的标准。
You will need to specify a FetchProfile that will give the criteria of messages you wand to get from the server.
下面和示例中使用它。
http://docs.oracle.com/javaee/ 6 / API /使用javax /邮件/ FetchProfile.html
的http://metoojava.word$p$pss.com/2010/03/21/java-$c$c-to-receive-mail-using-javamailapi/
这篇关于JavaMail的只得到新消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!