freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

jamesjavamail構(gòu)建郵件服務(wù)實現(xiàn)-資料下載頁

2025-06-25 06:58本頁面
  

【正文】 *qq:67758633 * */ publicclassSearchMail{ privatestaticArrayListSearchTermlist=newArrayList()。 publicstaticvoidmain(String[]args){ //用戶信息 Stringuser=helloworld。 Stringpassword=881213。 //配置服務(wù)器屬性 Propertiesprops=newProperties()。 (,localhost)。//smtp服務(wù)器 (,true)。//是否smtp認(rèn)證 (,25)。//設(shè)置smtp端口 (,smtp)。//發(fā)郵件協(xié)議 (,pop3)。//收郵件協(xié)議 //創(chuàng)建會話 Sessionsession=(props,null)。 Storestore=null。 try{ //連接Store store=(pop3)。 (localhost,user,password)。 //打開Folder Folderfolder=(inbox)。 ()。 //構(gòu)造搜索規(guī)則 SearchTermsubterm=newSubjectTerm(測試)。 SearchTermfterm=newFromTerm(newInternetAddress(chenfeng@localhost))。 SearchTermst=newAndTerm(subterm,fterm)。 Message[]message=(st)。 //輸出搜索到的郵件的主題 for(inti=0。ii++){ (message[i].getSubject())。 } }catch(NoSuchProviderExceptione){ //TODOAutogeneratedcatchblock ()。 }catch(MessagingExceptione){ //TODOAutogeneratedcatchblock ()。 } } }package 。 import 。 import 。 import 。 import 。 import 。 import 。 import 。 import 。 import 。 import 。 import 。 import 。 import 。 /** * 使用Javamail的Search包實現(xiàn)對郵件的搜索功能 * @author (Kevin)br * mail:chenfeng@br * qq:67758633 * */ public class SearchMail { private static ArrayListSearchTerm list=new ArrayList()。 public static void main(String[] args) { //用戶信息 String user = helloworld。 String password = 881213。 // 配置服務(wù)器屬性 Properties props = new Properties()。 (, localhost)。 // smtp服務(wù)器 (, true)。 // 是否smtp認(rèn)證 (, 25)。 // 設(shè)置smtp端口 (, smtp)。 // 發(fā)郵件協(xié)議 (, pop3)。 // 收郵件協(xié)議 //創(chuàng)建會話 Session session = (props, null)。 Store store=null。 try { //連接Store store = (pop3)。 (localhost, user, password)。 //打開Folder Folder folder = (inbox)。 ()。 //構(gòu)造搜索規(guī)則 SearchTerm subterm = new SubjectTerm(測試)。 SearchTerm fterm = new FromTerm(new InternetAddress(chenfeng@localhost))。 SearchTerm st=new AndTerm(subterm,fterm)。 Message[] message=(st)。 //輸出搜索到的郵件的主題 for (int i = 0。 i 。 i++) { (message[i].getSubject())。 } } catch (NoSuchProviderException e) { // TODO Autogenerated catch block ()。 } catch (MessagingException e) { // TODO Autogenerated catch block ()。 } } } 本例只展示如何使用Javamail的Search包實現(xiàn)對郵件的搜索功能,在實際應(yīng)用中,Search包中還存在許多功能相當(dāng)完備的API,若對這部分內(nèi)容有興趣可自行參考Javamail API。   API明細:/9 James郵件服務(wù)器的高級應(yīng)用與配置 配置郵箱域名   ,文件位于\apps\james\SARINF目錄下。在配置文件中找到: Java代碼 postmasterPostmaster@localhost/postmaster servernamesautodetect=trueautodetectIP=true !CONFIRM? servernamelocalhost/servername /servernamespostmasterPostmaster@localhost/postmaster servernames autodetect=true autodetectIP=true ! CONFIRM? servernamelocalhost/servername /servernames 這兩項內(nèi)容,把其中的localhost改成你所要配置的域名即可。 將用戶信息配置為數(shù)據(jù)庫存儲方式   James服務(wù)器提供了相當(dāng)完善的配置方案,可選擇將用戶信息保存在文件、數(shù)據(jù)庫或其他介質(zhì)中。在默認(rèn)的情況下,服務(wù)器將用戶信息以加密形式保存于\\apps\james   \var\users目錄下的文件中。我們可以通過改變其配置信息從而改變用戶信息的保存方式。在此僅以MYSQL數(shù)據(jù)庫的配置方式為例說明。 第一步:   將相應(yīng)數(shù)據(jù)庫的JDBC驅(qū)動包復(fù)制到lib目錄下 \\lib目錄下 第二步:   新建數(shù)據(jù)庫,建立一個用于存放James用戶信息的數(shù)據(jù)庫(表不用建,由James自動創(chuàng)建),在這里,我們假設(shè)新建的數(shù)據(jù)庫為mail 第三步:   ,文件位于\apps\james\SARINF目錄下。,找到以下內(nèi)容: Java代碼 repositoryname=LocalUsersclass= destinationURL=file://var/users// /repository repository name=LocalUsers class= destination URL=file://var/users// /repository 把這部分內(nèi)容修改為: Java代碼 repositoryname=LocalUsersclass=destinationURL=db://maildb/users sqlFilefile://conf//sqlFile /repositoryrepository name=LocalUsers class= destinationURL=db://maildb/users sqlFilefile://conf//sqlFile /repository 第四步:   找到MySQL配置位置 Java代碼 !Example,connectingtoaMySQLdatabasecalledmailonlocalhost ! !ThemaxvalueisthemaximumnumberofconcurrentconnectionsJameswill !opentothisdatabase !IfyouseeSQLException:Givingup...noconnectionsavailable.inyour !logfilesorbouncedmailyoushouldincreasethisvalue ! datasourcename=maildbclass= driver/driver dburljdbc:mysql:///dburl userusername/user passwordpassword/password 1
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1