免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版
打開APP
未登錄
開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服
開通VIP
首頁
好書
留言交流
下載APP
聯(lián)系客服
黑馬 JavaMail加深總結(jié)pop3協(xié)議收郵件
Babylly
>《java文章》
2011.11.26
關(guān)注
package
com.skycn.pop3;
import
java.io.File;
import
java.util.Properties;
/***
* 收郵件基本信息
* @author tianzhw
*
*/
public
class
MailReceiverInfo {
//郵件服務(wù)器IP和端口和協(xié)議
private
String mailServerHost;
private
String mailServerPost;
private
String protpcal =
"pop3"
;
//登錄郵件服務(wù)器的用戶名和密碼
private
String userName;
private
String passWord;
//保存郵件的路徑
private
String attchmentDir =
""
;
private
String emailDir =
""
;
private
String emailFileSuffix =
".eml"
;
//是否要確認(rèn)身份
private
boolean
vaildate =
true
;
//獲得郵件的屬性初始化
public
Properties getProperties() {
Properties properties =
new
Properties();
properties.put(
"mail.pop3.host"
, mailServerHost);
properties.put(
"mail.pop3.port"
, mailServerPost);
properties.put(
"mail.pop3.auth"
, vaildate ?
"true"
:
"false"
);
return
properties;
}
public
String getMailServerHost() {
return
mailServerHost;
}
public
void
setMailServerHost(String mailServerHost) {
this
.mailServerHost = mailServerHost;
}
public
String getMailServerPost() {
return
mailServerPost;
}
public
void
setMailServerPost(String mailServerPost) {
this
.mailServerPost = mailServerPost;
}
public
String getProtpcal() {
return
protpcal;
}
public
void
setProtpcal(String protpcal) {
this
.protpcal = protpcal;
}
public
String getUserName() {
return
userName;
}
public
void
setUserName(String userName) {
this
.userName = userName;
}
public
String getPassWord() {
return
passWord;
}
public
void
setPassWord(String passWord) {
this
.passWord = passWord;
}
public
String getAttchmentDir() {
return
attchmentDir;
}
public
void
setAttchmentDir(String attchmentDir) {
if
(!attchmentDir.endsWith(File.separator)) {
attchmentDir = attchmentDir + File.separator;
}
this
.attchmentDir = attchmentDir;
}
public
String getEmailDir() {
return
emailDir;
}
public
void
setEmailDir(String emailDir) {
if
(!emailDir.endsWith(File.separator)) {
emailDir = emailDir + File.separator;
}
this
.emailDir = emailDir;
}
public
String getEmailFileSuffix() {
return
emailFileSuffix;
}
public
void
setEmailFileSuffix(String emailFileSuffix) {
if
(!emailFileSuffix.endsWith(File.separator)) {
emailFileSuffix = emailFileSuffix + File.separator;
}
this
.emailFileSuffix = emailFileSuffix;
}
public
boolean
isVaildate() {
return
vaildate;
}
public
void
setVaildate(
boolean
vaildate) {
this
.vaildate = vaildate;
}
}
view plain
copy to clipboard
print
?
package
com.skycn.pop3;
import
java.io.BufferedReader;
import
java.io.BufferedWriter;
import
java.io.ByteArrayOutputStream;
import
java.io.File;
import
java.io.FileWriter;
import
java.io.IOException;
import
java.io.InputStreamReader;
import
java.io.Reader;
import
java.io.StringReader;
import
java.io.UnsupportedEncodingException;
import
javax.mail.BodyPart;
import
javax.mail.Flags;
import
javax.mail.Folder;
import
javax.mail.Message;
import
javax.mail.MessagingException;
import
javax.mail.Multipart;
import
javax.mail.NoSuchProviderException;
import
javax.mail.Part;
import
javax.mail.Session;
import
javax.mail.Store;
import
javax.mail.internet.InternetAddress;
import
javax.mail.internet.MimeMessage;
import
javax.mail.internet.MimeUtility;
import
javax.xml.crypto.Data;
import
com.skycn.helper.MyAuthenticator;
/*******************************************************************************
* 郵件接收器,目前支持pop3協(xié)議 能夠接受文本,html和帶有福建的郵件
*
* @author tianzhw
*/
@SuppressWarnings
(
"unused"
)
public
class
MailReceiver {
private
MailReceiverInfo receiverInfo;
// 郵件的參數(shù)配置
private
Store store;
// 以郵件服務(wù)器連接后得到的郵箱
private
Folder folder;
// 收件箱
private
Message[] messages;
// 收件箱中的郵件消息
private
Message currentMessage;
// 正在處理的郵件消息
private
String currentEmailFileName;
public
MailReceiver(MailReceiverInfo receiverInfo) {
this
.receiverInfo = receiverInfo;
}
/***************************************************************************
* 收郵件
*/
public
void
receiveAllMail()
throws
Exception {
if
(
this
.receiverInfo ==
null
) {
throw
new
Exception(
"必須提供收郵件的參數(shù)"
);
}
// 打開連接
if
(
this
.connectToServer()) {
// 打開收件箱
if
(
this
.openInBoxFolder()) {
// 收件箱里面的郵件信息輸出
this
.getAllMail();
this
.closeConnection();
}
else
{
throw
new
Exception(
"打開連接失敗"
);
}
}
else
{
throw
new
Exception(
"打開連接失敗"
);
}
}
/***************************************************************************
* 登錄服務(wù)器,登錄服務(wù)器,通過Session對象創(chuàng)建store對象。同時講session對象中認(rèn)證名和密碼,協(xié)議描述,等信息通知服務(wù)器。
*/
@SuppressWarnings
(
"unused"
)
private
boolean
connectToServer() {
// 判斷是否需要身份認(rèn)證
MyAuthenticator authenticator =
null
;
if
(
this
.receiverInfo.isVaildate()) {
// 如果需要身份認(rèn)證,則創(chuàng)建一個密碼驗(yàn)證器
authenticator =
new
MyAuthenticator(
this
.receiverInfo.getUserName(),
this
.receiverInfo
.getPassWord());
}
// 創(chuàng)建一個session
Session mailSession = Session.getInstance(
this
.receiverInfo
.getProperties());
try
{
// 創(chuàng)建store,建立連接,通過Session對象是可以創(chuàng)建一個store對象的。
this
.store = mailSession.getStore(
this
.receiverInfo.getProtpcal());
}
catch
(NoSuchProviderException e) {
System.out.println(
"鏈接服務(wù)器失敗"
);
return
false
;
}
System.out.println(
"connecting"
);
try
{
this
.store.connect();
}
catch
(MessagingException e) {
// TODO Auto-generated catch block
System.out.println(
"鏈接服務(wù)器失敗"
);
return
false
;
}
return
true
;
}
/***************************************************************************
* 打開收件箱
* stroe是一個郵箱的整體,如果連接上以后,我們有很多抽屜,Inbox是國際默認(rèn)的收件箱(抽屜的)標(biāo)示。但是也有不是這樣的,這取決于什么郵件服務(wù)器
*/
private
boolean
openInBoxFolder() {
try
{
this
.folder =
this
.store.getFolder(
"inbox"
);
folder.open(Folder.READ_ONLY);
return
true
;
}
catch
(MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return
false
;
}
/***************************************************************************
* 關(guān)閉鏈接
*
* @return
*/
private
boolean
closeConnection() {
try
{
if
(
this
.folder.isOpen()) {
this
.folder.close(
true
);
}
this
.store.close();
System.out.println(
"關(guān)閉鏈接成功 "
);
return
true
;
}
catch
(MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return
false
;
}
private
void
getAllMail()
throws
Exception {
// 文件夾下獲取郵件信息
this
.messages =
this
.folder.getMessages();
System.out.println(
"總郵件數(shù)目:"
+ messages.length);
System.out.println(
"新郵件數(shù)目:"
+
this
.getNewMessageCount());
System.out.println(
"未讀郵件數(shù)目:"
+
this
.getUnreadMessageConunt());
// 將要下載的郵件數(shù)量
int
mailArrayLength =
this
.getMessageCount();
System.out.println(
"一共有郵件"
+ mailArrayLength +
"封"
);
int
errorCounter =
0
;
int
successCounter =
0
;
for
(
int
index =
0
; index < mailArrayLength; index++) {
this
.currentMessage = messages[index];
System.out.println(
"正在獲取第"
+ index +
"封郵件~~~~~~~~~~~~~~"
);
this
.showMailBasicInfo();
}
}
private
void
showMailBasicInfo()
throws
Exception {
// TODO Auto-generated method stub
showMailBasicInfo(
this
.currentMessage);
}
/***************************************************************************
* 顯示郵件的基本信息
*
* @param message
* @throws Exception
*/
private
void
showMailBasicInfo(Message message)
throws
Exception {
// TODO Auto-generated method stub
System.out.println(
"~~~~~~~~~~~郵件ID:"
+
this
.getMessageId()
+
"~~~~~~~~~~~~~~~~~~~~~~~ "
);
System.out.println(
"From:"
+
this
.getFrom());
System.out.println(
"To:"
+
this
.getToAddress());
System.out.println(
"CC:"
+
this
.getCCAddress());
System.out.println(
"BCC:"
+
this
.getBCCAddress());
System.out.println(
"Subject:"
+
this
.getSubject());
System.out.println(
"發(fā)送時間:"
+
this
.getSentDate());
System.out.println(
"是新郵件?:"
+
this
.isNew());
System.out.println(
"是否回執(zhí):"
+
this
.getReplySign());
System.out.println(
"包涵附件:"
+
this
.isContainAttch());
System.out
.println(
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
);
}
private
boolean
isContainAttch()
throws
Exception {
// TODO Auto-generated method stub
return
isContainAttch(
this
.currentMessage);
}
/***************************************************************************
* 判斷郵件是否是包含附件
*
* @param part
* @return
* @throws Exception
*/
private
boolean
isContainAttch(Part part)
throws
Exception {
boolean
attachflag =
false
;
if
(part.isMimeType(
"multipart/*"
)) {
// 如果郵件體包含多部分
Multipart mp = (Multipart) part.getContent();
for
(
int
i =
0
; i < mp.getCount(); i++) {
BodyPart bodyPart = mp.getBodyPart(i);
String disposition = bodyPart.getDisposition();
if
((disposition !=
null
)
&& ((disposition.equals(Part.ATTACHMENT) || (disposition
.equals(Part.INLINE))))) {
attachflag =
true
;
}
else
if
(bodyPart.isMimeType(
"Multipart/*"
)) {
attachflag = isContainAttch((Part) bodyPart);
}
else
{
String contype = bodyPart.getContentType();
if
(contype.toLowerCase().indexOf(
"applcation"
) != -
1
) {
attachflag =
true
;
}
if
(contype.toLowerCase().indexOf(
"name"
) != -
1
) {
attachflag =
true
;
}
}
}
}
else
if
(part.isMimeType(
"message/rfc822"
)) {
attachflag = isContainAttch((Part) part.getContent());
}
return
attachflag;
}
private
String getMessageId()
throws
Exception {
// TODO Auto-generated method stub
return
getMessageId(
this
.currentMessage);
}
/***************************************************************************
* 獲得Message - Id
*
*
@param
mimeMessage
*
@return
*
@throws
Exception
*/
private
String getMessageId(Message mimeMessage)
throws
Exception {
MimeMessage message = (MimeMessage) mimeMessage;
return
message.getMessageID();
}
private
boolean
getReplySign()
throws
Exception {
// TODO Auto-generated method stub
return
getReplySign(
this
.currentMessage);
}
/***************************************************************************
* 判斷郵件是否需要回執(zhí)。
*
* @param mimeMessage
* @return
* @throws Exception
*/
private
boolean
getReplySign(Message mimeMessage)
throws
Exception {
// TODO Auto-generated method stub
boolean
replaysign =
false
;
String[] needreply = (String[]) mimeMessage
.getHeader(
"Disposition-Notification-To"
);
if
(needreply !=
null
) {
replaysign =
true
;
}
return
replaysign;
}
private
boolean
isNew()
throws
Exception {
// TODO Auto-generated method stub
return
isNew(
this
.currentMessage);
}
/***************************************************************************
* 獲得郵件是否是已經(jīng)讀過了
*
* @param mimeMessage
* @return
* @throws Exception
*/
private
boolean
isNew(Message mimeMessage)
throws
Exception {
// TODO Auto-generated method stub
boolean
isnew =
false
;
Flags flags = mimeMessage.getFlags();
Flags.Flag[] flag = flags.getSystemFlags();
for
(
int
i =
0
; i < flag.length; i++) {
if
(flag[i] == Flags.Flag.SEEN) {
isnew =
true
;
break
;
}
}
return
false
;
}
private
Data getSentDate()
throws
Exception {
// TODO Auto-generated method stub
return
getSetDate(
this
.currentMessage);
}
/**
* 獲得郵件的發(fā)送日期
*
* @param mimeMessage
* @return
* @throws Exception
*/
private
Data getSetDate(Message mimeMessage)
throws
Exception {
// TODO Auto-generated method stub
return
(Data) mimeMessage.getSentDate();
}
/**
* 獲得郵件的發(fā)送主題
*
* @return
* @throws Exception
*/
private
String getSubject()
throws
Exception {
return
getSubject(
this
.currentMessage);
}
private
String getSubject(Message mimeMessage)
throws
Exception {
// TODO Auto-generated method stub
String subject =
""
;
try
{
subject = MimeUtility.decodeText(mimeMessage.getSubject());
if
(subject ==
null
) {
subject =
""
;
}
}
catch
(Exception e) {
}
return
subject;
}
/***************************************************************************
* 獲得發(fā)件人的地址和姓名
*
* @return
* @throws Exception
*/
private
String getFrom()
throws
Exception {
return
getFrom(
this
.currentMessage);
}
/***************************************************************************
* 獲得發(fā)件人的地址和姓名
*
* @return
* @throws Exception
*/
private
String getFrom(Message mimeMessage)
throws
Exception {
InternetAddress[] address = (InternetAddress[]) mimeMessage.getFrom();
// 獲得發(fā)件人的郵件地址
String from = address[
0
].getAddress();
if
(from ==
null
) {
from =
""
;
}
// 獲得發(fā)件人的描述
String personal = address[
0
].getPersonal();
if
(personal ==
null
) {
personal =
""
;
}
String fromaddr = personal +
"<"
+ from +
">"
;
return
fromaddr;
}
/**
* 根據(jù)傳遞的參數(shù)的不同,獲得郵件收件人、抄送、密送的地址和姓名 to---收件人 cc----抄送人 bcc----密送人
*
* @return
* @throws Exception
*/
private
String getBCCAddress()
throws
Exception {
// TODO Auto-generated method stub
return
getMailAddress(
"BCC"
,
this
.currentMessage);
}
private
String getCCAddress()
throws
Exception {
// TODO Auto-generated method stub
return
getMailAddress(
"CC"
,
this
.currentMessage);
}
private
String getToAddress()
throws
Exception {
// TODO Auto-generated method stub
return
getMailAddress(
"TO"
,
this
.currentMessage);
}
/***************************************************************************
* 獲得郵件地址
*
* @param type
* 類型 如 收件人 抄送人 密送人
* @param mimeMessage
* 郵件消息
* @return
* @throws Exception
*/
private
String getMailAddress(String type, Message mimeMessage)
throws
Exception {
String mailaddr =
""
;
String addtype = type.toUpperCase();
InternetAddress[] address =
null
;
if
(addtype.equals(
"TO"
) || addtype.equals(
"CC"
)
|| addtype.equals(
"BCC"
)) {
if
(addtype.equals(
"TO"
)) {
address = (InternetAddress[]) mimeMessage
.getRecipients(Message.RecipientType.TO);
}
if
(addtype.equals(
"CC"
)) {
address = (InternetAddress[]) mimeMessage
.getRecipients(Message.RecipientType.CC);
}
if
(addtype.equals(
"BCC"
)) {
address = (InternetAddress[]) mimeMessage
.getRecipients(Message.RecipientType.BCC);
}
if
(address !=
null
) {
for
(
int
i =
0
; i < address.length; i++) {
// 先獲取郵件地址
String email = address[i].getAddress();
if
(email ==
null
) {
email =
""
;
}
else
{
email = MimeUtility.decodeText(email);
}
// 再取得個人描述信息
String personal = address[i].getPersonal();
if
(personal ==
null
) {
personal =
""
;
}
else
{
personal = MimeUtility.decodeText(personal);
}
// 講個人描述信息與郵件地址連接起來
String compostiteto = personal +
"<"
+ email +
">"
;
// 多個地址用,號分隔
mailaddr +=
","
+ compostiteto;
}
mailaddr = mailaddr.substring(
1
);
}
}
else
{
throw
new
Exception(
"錯誤的地址類型"
);
}
return
mailaddr;
}
/***************************************************************************
* 獲得messages中Message的個數(shù)
*
* @return
*/
private
int
getMessageCount() {
// TODO Auto-generated method stub
return
this
.messages.length;
}
/**
* 獲得郵件里面未讀的郵件個數(shù)
*
* @return
* @throws MessagingException
*/
private
int
getUnreadMessageConunt()
throws
MessagingException {
// TODO Auto-generated method stub
return
this
.folder.getUnreadMessageCount();
}
/**
* 獲得郵件里面新郵件的個數(shù)
*
* @return
* @throws MessagingException
*/
private
int
getNewMessageCount()
throws
MessagingException {
// TODO Auto-generated method stub
return
this
.folder.getNewMessageCount();
}
/***************************************************************************
* 獲得當(dāng)前郵件
*
* @throws MessagingException
* @throws IOException
*/
private
void
getMail()
throws
Exception {
this
.saveMessageAsFile(
this
.currentMessage);
this
.parseMessage(
this
.currentMessage);
}
/***************************************************************************
* 解析郵件
*
* @param currentMessage2
* @throws MessagingException
* @throws IOException
*/
private
void
parseMessage(Message message)
throws
IOException,
MessagingException {
Object content = message.getContent();
if
(content
instanceof
Multipart) {
handleMultipart((Multipart) content);
}
else
{
handlePart(message);
}
}
/***************************************************************************
* 解析Multipart
*
* @param content
* @throws MessagingException
* @throws IOException
*/
private
void
handleMultipart(Multipart multipart)
throws
MessagingException, IOException {
for
(
int
i =
0
, n = multipart.getCount(); i < n; i++) {
handlePart(multipart.getBodyPart(i));
}
}
/***************************************************************************
*
* @param bodyPart
* @throws MessagingException
* @throws IOException
*/
private
void
handlePart(Part part)
throws
MessagingException, IOException {
String dispostion = part.getDisposition();
String contentType = part.getContentType();
String fileNameWidthExtension =
""
;
// 獲得郵件的內(nèi)容輸入流
InputStreamReader sbis =
new
InputStreamReader(part.getInputStream());
// 在沒有附件的情況
if
(dispostion ==
null
) {
if
((contentType.length() >=
10
)
&& (contentType.toLowerCase().substring(
0
,
10
)
.equals(
"text/plain"
))) {
fileNameWidthExtension =
this
.receiverInfo.getAttchmentDir()
+
this
.currentEmailFileName +
".txt"
;
}
else
if
((contentType.length() >=
9
)
&& (contentType.toLowerCase().substring(
0
,
9
)
.equals(
"text/html"
))) {
fileNameWidthExtension =
this
.receiverInfo.getAttchmentDir()
+
this
.currentEmailFileName +
".html"
;
}
else
if
((contentType.length() >=
9
)
&& (contentType.toLowerCase().substring(
0
,
9
)
.equals(
"text/gif"
))) {
fileNameWidthExtension =
this
.receiverInfo.getAttchmentDir()
+
this
.currentEmailFileName +
".gif"
;
}
else
if
((contentType.length() >=
9
)
&& (contentType.toLowerCase().substring(
0
,
9
)
.equals(
"multipart/*"
))) {
handleMultipart((Multipart) part.getContent());
}
else
{
fileNameWidthExtension =
this
.receiverInfo.getAttchmentDir()
+
this
.currentEmailFileName +
".txt"
;
}
System.out.println(
"保存郵件內(nèi)容到:"
+ fileNameWidthExtension);
saveFile(fileNameWidthExtension, sbis);
return
;
}
// 各種有附件的情況
String name =
""
;
if
(dispostion.equalsIgnoreCase(Part.ATTACHMENT)) {
name = getFileName(part);
fileNameWidthExtension =
this
.receiverInfo.getAttchmentDir() + name;
}
else
if
(dispostion.equalsIgnoreCase(Part.INLINE)) {
name = getFileName(part);
fileNameWidthExtension =
this
.receiverInfo.getAttchmentDir() + name;
}
else
{
}
// 儲存各類附件
if
(!fileNameWidthExtension.equals(
""
)) {
System.out.println(
"保存郵件附件到:"
+ fileNameWidthExtension);
saveFile(fileNameWidthExtension, sbis);
}
}
private
String getFileName(Part part)
throws
UnsupportedEncodingException,
MessagingException {
String fileName = part.getFileName();
fileName = MimeUtility.decodeText(fileName);
String name = fileName;
if
(fileName !=
null
) {
int
index = fileName.lastIndexOf(
"/"
);
if
(index != -
1
) {
name = fileName.substring(index +
1
);
}
}
return
name;
}
/***************************************************************************
* 保存郵件源文件
*
*
@param
currentMessage2
*/
private
void
saveMessageAsFile(Message message) {
try
{
// 將郵件ID中尖括號中的部分作為郵件的文件名
String oriFileName = getInfoBetweenBrackets(
this
.getMessageId(
message).toString());
// 設(shè)置文件后綴名,如是附件則設(shè)法取得其文件后綴名作為將要保存文件的后綴名。如是正文不封則用。html作為后綴名
String emlName = oriFileName;
String fileNameWidthExtension =
this
.receiverInfo.getEmailDir()
+ oriFileName +
this
.receiverInfo.getEmailFileSuffix();
File storeFile =
new
File(fileNameWidthExtension);
for
(
int
i =
0
; storeFile.exists(); i++) {
emlName = oriFileName + i;
fileNameWidthExtension =
this
.receiverInfo.getEmailDir()
+ emlName +
this
.receiverInfo.getEmailFileSuffix();
storeFile =
new
File(fileNameWidthExtension);
}
this
.currentEmailFileName = emlName;
System.out.println(
"郵件消息的存儲路徑:"
+ fileNameWidthExtension);
// 將郵件消息的內(nèi)容寫入ByteArrayOutputStram流中
ByteArrayOutputStream baos =
new
ByteArrayOutputStream();
message.writeTo(baos);
StringReader in =
new
StringReader(baos.toString());
saveFile(fileNameWidthExtension, in);
}
catch
(Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 保存文件內(nèi)容
*
* @param fileName
* @param in
* @throws IOException
*/
private
void
saveFile(String fileName, Reader in)
throws
IOException {
// 為了防止文件名重名,在重名的文件后面添加上數(shù)字
File file =
new
File(fileName);
// 先取得文件名的后綴
int
lastDot = fileName.lastIndexOf(
"."
);
String extension = fileName.substring(lastDot);
fileName = fileName.substring(
0
, lastDot);
for
(
int
i =
0
; file.exists(); i++) {
file =
new
File(fileName + i + extension);
}
// 從輸入流中讀取數(shù)據(jù),寫入文件的輸入流
FileWriter fos =
new
FileWriter(file);
BufferedWriter bos =
new
BufferedWriter(fos);
BufferedReader bis =
new
BufferedReader(in);
int
aByte;
while
((aByte = bis.read()) != -
1
) {
bos.write(aByte);
}
bos.flush();
bos.close();
bis.close();
}
/**
* 獲得尖括號之間的字符串 如 tianzhw <tianzhw@vip.qq.com> ----- tianzhw@vip.qq.cpm
*
* @param string
* @return
*/
private
String getInfoBetweenBrackets(String str) {
int
i, j;
if
(str ==
null
) {
str =
"error"
;
return
str;
}
i = str.lastIndexOf(
"<"
);
j = str.lastIndexOf(
">"
);
if
(i !=
1
&& j != -
1
) {
str = str.substring(i +
1
, j);
}
return
str;
}
public
static
void
main(String[] args)
throws
Exception {
MailReceiverInfo info =
new
MailReceiverInfo();
info.setMailServerHost(
"pop.163.com"
);
info.setMailServerPost(
"110"
);
info.setVaildate(
true
);
info.setUserName(
"*************"
);
info.setPassWord(
"*************"
);
info.setAttchmentDir(
"F:/mails"
);
info.setEmailDir(
"F:/mails"
);
MailReceiver receiver =
new
MailReceiver(info);
receiver.receiveAllMail();
}
}
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點(diǎn)擊舉報
。
打開APP,閱讀全文并永久保存
查看更多類似文章
猜你喜歡
類似文章
用java收郵件
HttpClient工具類
聊聊rocketmq的LitePullConsumer
POI3.5讀取Excel2007
一步一步android(15):關(guān)于socket編程【以聊天為例】_目睹一個Geek的生活...
《Java Web應(yīng)用程序開發(fā)》02 IO流
更多類似文章 >>
生活服務(wù)
首頁
萬象
文化
人生
生活
健康
教育
職場
理財(cái)
娛樂
藝術(shù)
上網(wǎng)
留言交流
回頂部
聯(lián)系我們
分享
收藏
點(diǎn)擊這里,查看已保存的文章
導(dǎo)長圖
關(guān)注
一鍵復(fù)制
下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!
聯(lián)系客服
微信登錄中...
請勿關(guān)閉此頁面
先別劃走!
送你5元優(yōu)惠券,購買VIP限時立減!
5
元
優(yōu)惠券
優(yōu)惠券還有
10:00
過期
馬上使用
×