当前位置: 技术问答>java相关
请问哪里有将attachment从邮件中分离出来的例子呀
来源: 互联网 发布时间:2015-08-12
本文导语: 能保存成文件的 | void jButton6_actionPerformed(ActionEvent e) { try {//该程序为接受带有附件的邮件的代码 Properties props = System.getProperties(); Authenticator auth = new...
能保存成文件的
|
void jButton6_actionPerformed(ActionEvent e) {
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
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