最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
改写后的使用javamail pop3收信的javabean
时间:2022-07-02 18:11:10 编辑:袖梨 来源:一聚教程网
/*
*Author:tyfun
*DateTime:2003.01.10
*Package:com.westarsoft.mail
*/
package com.westarsoft.mail;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
public class GetMail {
public static String receive(String popServer, String popUser, String popPassword) {
String mailContent = "";
Store store = null;
Folder folder = null;
try {
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
store = session.getStore("pop3");
store.connect(popServer, popUser, popPassword);
folder = store.getDefaultFolder();
if(folder == null) throw new Exception("No default folder");
folder = folder.getFolder("INBOX");
if(folder == null) throw new Exception("No POP3 INBOX");
folder.open(Folder.READ_ONLY);
Message[] msgs = folder.getMessages();
for(int msgNum = 0; msgNum < msgs.length; msgNum++) {
*Author:tyfun
*DateTime:2003.01.10
*Package:com.westarsoft.mail
*/
package com.westarsoft.mail;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
public class GetMail {
public static String receive(String popServer, String popUser, String popPassword) {
String mailContent = "";
Store store = null;
Folder folder = null;
try {
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
store = session.getStore("pop3");
store.connect(popServer, popUser, popPassword);
folder = store.getDefaultFolder();
if(folder == null) throw new Exception("No default folder");
folder = folder.getFolder("INBOX");
if(folder == null) throw new Exception("No POP3 INBOX");
folder.open(Folder.READ_ONLY);
Message[] msgs = folder.getMessages();
for(int msgNum = 0; msgNum < msgs.length; msgNum++) {
相关文章
- 以闪亮之名店长体验流霞季怎么玩 缘溪临霞套装活动介绍 12-31
- 未定事件簿旧梦新生左然篇怎么玩 旧梦新生左然篇活动介绍 12-31
- 未定事件簿左然破浪远行怎么样 12-31
- 桃源深处有人家行医问诊怎么玩 12-31
- 恋与制作人跨年福利有哪些 恋与制作人跨年福利内容介绍 12-31
- 阴阳师协同对弈大乱斗怎么玩 阴阳师协同对弈大乱斗活动介绍 12-31