首先必须获取链接:
Properties props = new Properties();
Session session = Session.getInstance(props);
Store store = session.getStore(receiptorPro);
store.connect(“接受邮件服务器”, “端口”, “用户名”, “密码”);
打开Folder:
Folder inbox = store.getFolder("INBOX");
Folder有pop3和imap两种:
IMAPFolder folder = (IMAPFolder) inbox;
folder.open(Folder.READ_WRITE);//Folder.READ_WRITE为打开状态
获取邮件:
Message[] messages = folder.getMessages();
for (int i = 0; i < messages.length; i++) {
Date sendDate = messages[i].getSentDate();
//ok 就能取出发送时间
}
哈哈哈~~我不知道啊!!