本文整理汇总了Java中javax.mail.Folder.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Folder.getMessage方法的具体用法?Java Folder.getMessage怎么用?Java Folder.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.mail.Folder
的用法示例。
在下文中一共展示了Folder.getMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEmail
import javax.mail.Folder; //导入方法依赖的package包/类
public void getEmail() throws MessagingException, IOException {
Session session = Session.getDefaultInstance(System.getProperties(),null);
Store store = null;
store = session.getStore("imaps");
// store.connect(this.host, this.userName, this.password);
// Get default folder
Folder folder = store.getDefaultFolder();
folder.getMessages();
folder.getNewMessageCount();
Message m = folder.getMessage(0);
m.getMessageNumber();
m.getAllRecipients();
m.getReceivedDate();
m.getFrom();
m.getSubject();
m.getReplyTo();
m.getContent();
m.getSize();
// Get any folder by name
Folder[] folderList = folder.list();
}
示例2: retrieveViaImap
import javax.mail.Folder; //导入方法依赖的package包/类
private Message retrieveViaImap(String host, int port, String user,
String password) throws MessagingException {
Properties props = new Properties();
props.setProperty("mail.store.protocol", "imap");
props.setProperty("mail.imap.port", String.valueOf(port));
Session session = Session.getInstance(props, null);
Store store = session.getStore();
store.connect(host, user, password);
Folder inbox = store.getFolder("INBOX");
inbox.open(Folder.READ_ONLY);
int messageCount = inbox.getMessageCount();
return messageCount == 0 ? null : inbox.getMessage(1);
}
示例3: getNextRowData
import javax.mail.Folder; //导入方法依赖的package包/类
@Override
protected Object getNextRowData(AdapterRowSet rows) throws AdapterException {
try {
Folder inbox = ((IMAPAdapter) getAdapter()).inbox;
if (getRowNumberToRead() < inbox.getMessageCount()) {
return inbox.getMessage(getRowNumberToRead()+1);
} else {
hasNoMoreRows();
return null;
}
} catch (MessagingException e) {
throw new AdapterException(e);
}
}