【正文】
esc結(jié)構(gòu)數(shù)組。在設(shè)置MapFileDesc結(jié)構(gòu)時,將MapFileDesc結(jié)構(gòu)數(shù)組賦值給MapiMessage結(jié)構(gòu)的lpFile成員。 //加載動態(tài)庫/////////////////////////獲取函數(shù)指針(FARPROCamp。(FARPROCamp。(FARPROCamp。 (FARPROCamp。 unsigned long a。a)。 CTime time = CTime::GetCurrentTime()。 char date[50]。 CString receiveman = ReMail。39。 int receivenum = 0。 num = (39。,num+1)。 CString* addr1 = new CString[receivenum]。//記錄SMTP服務(wù)器 MapiRecipDesc* m_receiver = new MapiRecipDesc[receivenum]。nreceivenum。 /////////////////////////////////獲取用戶賬戶 receiver = ((39。))。39。 if(manindex == 1) man = receiveman。 receiveman = (()manindex1)。 receiver = SMTP:+man。 m_receiver[n].ulReserved = 0。 m_receiver[n].lpszName = addr1[n].GetBuffer(0)。 m_receiver[n].ulEIDSize = 0。//定義接收者信息 } MapiMessage* m_messageInfo。//////////////////////初始化m_messageInfo memset(m_messageInfo,0,sizeof(MapiMessage))。//設(shè)置郵件正文 m_messageInfoulReserved = 0。 //設(shè)置主題 m_messageInfolpszDateReceived = date。 //郵件所屬線程一個字符串指針 m_messageInfoflFlags = MAPI_SENT。 //發(fā)送者信息 m_messageInfonRecipCount = receivenum。 //設(shè)置接收者信息 m_messageInfolpszMessageType = NULL。 //附件數(shù)////////////////////////////////////MapiFileDesc結(jié)構(gòu)數(shù)組MapiFileDesc * m_mapifiledesc = new MapiFileDesc[filenum]。 annex = AnnexMail。 CString* file = new CString[filenum]。ifilenum。 //保留,必須為0 m_mapifiledesc[i].flFlags = 0。 int index = (39。)。 else { pathfile = (index)。 } int pos = (39。)。 file[i] = (()pos1)。 m_mapifiledesc[i].lpszFileName = file[i].GetBuffer(0)。 } m_messageInfolpFiles = m_mapifiledesc。 //發(fā)送郵件 if (lresult != SUCCESS_SUCCESS) //判斷郵件是否發(fā)送成功 { AfxMessageBox(操作失敗.,64)。 } delete []addr1。 delete []path。 delete []m_receiver。 delete []m_mapifiledesc。 lpfnMAPILogoff(a,0,0,0)。 使用Jmail組件實現(xiàn)接收功能的詳細設(shè)計本系統(tǒng)通過Jmail組件實現(xiàn)郵件的接收。IPOP3Ptr指針負責與郵件服務(wù)器的連接,建立連接后可以通過IPOP3Ptr指針對象的Message指針來獲得郵件的具體內(nèi)容。Message指針的Count屬性能獲得郵件的數(shù)量,Message指針的Item屬性就是郵件文件。代碼如下:import using namespace jmail。代碼如下:CString strpop = ServerMail。//用戶名CString strpwd = PwdMail。jmail::IPOP3Ptr jpop。//創(chuàng)建對象實例try { jpopTimeout=120。//連接服務(wù)器 long mailcount=jpopMessagesCount。imailcount。//發(fā)件人CString recipients = (char*)jpopMessagesItem[i]GetRecipientsString()。//主題CString sort。//郵件UIDint index = (TO:)。else sort = 其他。//郵件內(nèi)容COleDateTime time = jpopMessagesItem[i]Date。//附件數(shù)量CString Attachments = 。jcount。//附件名 (select * from tb_receivebox where 郵件UID =39。and 郵箱用戶=39。,mailuid,UserMail)。 filepath = path。 filepath += mailuid。 jpopMessagesItem[i]GetAttachments()GetItem(j) SaveToFile((_bstr_t)filepath)。(1) 登陸模塊、主界面模塊和添加分類模塊測試運行程序,打開程序登錄界面。在主界面中顯示了各個信箱中的郵件信息,包括郵件總數(shù)和新郵件數(shù),單擊左側(cè)的按鈕可進入相應(yīng)的信箱。輸入菜單名稱,菜單標識自動增加,然后單擊“確定”按鈕即可。要想對郵件進行分類,必須讓發(fā)送者了解您的分類格式,當對方給您發(fā)送郵件時,在主題后面加上“TO:”+分類名稱即可,例如:“TO:文件”,則接收郵件后程序自動將該封郵件分到“文件”類中,當選擇“分類”菜單中的“文件”時,自動會顯示在列表中。輸入收件人郵箱地址,也可以單擊“選擇聯(lián)系人”按鈕選擇聯(lián)系人,通過“添加附件”和“刪除附件”按鈕可設(shè)置發(fā)送附件,單擊 “發(fā)送”按鈕即可發(fā)送郵件。:寫信頁面(3) 收件箱模塊單擊“收件箱”導航按鈕,進入收件箱頁面。:收件箱頁面(4) 草稿箱模塊單擊“草稿箱”導航按鈕,進入草稿箱頁面。:草稿箱頁面(5) 垃圾箱模塊單擊“垃圾箱”導航按鈕,進入垃圾箱頁面。:垃圾箱頁面(6) 通信錄模塊單擊“通訊錄”導航按鈕,單擊“添加”按鈕,可添加聯(lián)系人,單擊“編輯”按鈕,可編輯聯(lián)系人信息,單擊“刪除”按鈕,可刪除聯(lián)系人。:通信錄頁面:添加聯(lián)系人頁面:添加分組頁面6 總結(jié)本客戶端電子郵件軟件在功能上基本符合用戶需求,能夠完成發(fā)送郵件和接收郵件的基本操作。本系統(tǒng)所運用Jmail組件和MAPI函數(shù)實現(xiàn)郵件收發(fā)功能的代碼是在本人的師兄關(guān)某某的指導下完成的,由于時間緊迫所以一些服務(wù)器及相關(guān)電子郵件協(xié)議并未有透徹的理解,系統(tǒng)在功能方面也沒有考慮得很周到。另外,作為客戶端電子管理軟件,登錄的郵箱應(yīng)該多元化,本系統(tǒng)只提供單一的郵箱登陸,系統(tǒng)的進一步工作應(yīng)該是實現(xiàn)多個郵箱同時登錄,在同一時間管理用戶多個電子郵箱,滿足用戶繁忙的信息通信要求。參 考 文 獻[1]信息化 [2] 電子郵件 [3]Windows Live Mail Desktop [4] Koomail [5] 夢幻快車 [6] Foxmail [7] 譚浩強. Visual C++:清華大學出版社 2004[8] : 高等教育出版社 2005[9] :電子工業(yè)出版社 2006[10] :華中理工大學出版社 2001[11] Windows應(yīng)用程序設(shè)計(第2版).北京:清華大學出版社 2007[12] :人民郵電出版社 2007Design and Implement of Email Client SystemLiang Weitang(Computer Science and Engineering Department Zhongkai University of Agriculture and Technology, Guangzhou 510225,China)Abstract:With the deepening of reform and opening up the development of the establishment of a socialist market economy, information technology is accelerating the pace of the times.According to the latest release of the 20062020 national development strategies, information technology is the full use of information technology, development and utilization of information resources, facilitate the exchange of information and knowledgesharing and improve the quality of economic growth, promoting economic and social development of the historical process of transition.Email is the Internet network, as well as all other network system for the direct exchange of information between the systems, its data sender and the recipient are all human, so great to meet a lot of people there munications needs.In this paper, indepth understanding of the practical operation of management process on the basis of summing up the life of monly used functions, objectoriented programming using design thinking and the development of a simple, convenient client software, the realization of electronic Email the flexibility in management.Key words:Email Client Jmail groupware3