-2
通過JavaMail閱讀POP3郵件僅返回html通過JavaMail閱讀POP3郵件僅返回html
所以我問我該如何指定退貨? 平均收益messagefrom,messagedate和消息體
,我怎麼可以把我的結果標籤或文本域上
請一些人可以幫我
import java.util.Properties;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Store;
import java.awt.*;
import javax.swing.*;
public class Receiver {
public static void main(String[] args) throws Exception {
Properties props = new Properties();
String host = "mail.newhoster.org";
String username = "[email protected]";
String password = "I_hffngh12";
String provider = "pop3";
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore(provider);
store.connect(host, username, password);
Folder inbox = store.getFolder("INBOX");
if (inbox == null) {
System.out.println("No INBOX");
System.exit(1);
}
inbox.open(Folder.READ_ONLY);
Message[] messages = inbox.getMessages();
for (int i = 0; i < messages.length; i++) {
System.out.println("Message " + (i + 1));
messages[i].writeTo(System.out);
String olm = messages[i].getSubject();
System.out.println(olm);
// JFrame fa = new JFrame();
// fa.setBounds(20, 20, 300, 200);
// JLabel lb = new JLabel("hello every ");
// fa.add(lb);
// lb.setPreferredSize(new Dimension(100,100));
// lb.setBackground(Color.red);
//
// fa.setVisible(true);
}
inbox.close(false);
store.close();
}
}
您引用的數據全部通過'Message' API提供。 – EJP