当前位置: 技术问答>java相关
两个问题给你100分
来源: 互联网 发布时间:2015-05-31
本文导语: 1 JAVAMAIL里如何获得邮件的优先级? 2 JAVAMAIL里如何获得附件? 能段原代码,多谢! | try {//该程序为接受带有附件的邮件的代码 Properties props = System.getProperties(); ...
1 JAVAMAIL里如何获得邮件的优先级?
2 JAVAMAIL里如何获得附件?
能段原代码,多谢!
2 JAVAMAIL里如何获得附件?
能段原代码,多谢!
|
try
{//该程序为接受带有附件的邮件的代码
Properties props = System.getProperties();
Authenticator auth = new Email_Autherticator();
props.put("mail.smtp.host",host);
props.put("mail.smtp.auth","true");
Session session = Session.getDefaultInstance(props,auth); //建立session
Store store = session.getStore("pop3");
store.connect(host,username,password);
//After connecting to the Store,you can get a Folder,which must be opened before you can read messages from it:
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_WRITE);
Message message[] = folder.getMessages();
for (int i=0,n=message.length;i
{//该程序为接受带有附件的邮件的代码
Properties props = System.getProperties();
Authenticator auth = new Email_Autherticator();
props.put("mail.smtp.host",host);
props.put("mail.smtp.auth","true");
Session session = Session.getDefaultInstance(props,auth); //建立session
Store store = session.getStore("pop3");
store.connect(host,username,password);
//After connecting to the Store,you can get a Folder,which must be opened before you can read messages from it:
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_WRITE);
Message message[] = folder.getMessages();
for (int i=0,n=message.length;i