2011-10-05 48 views

回答

1

一个例子URL访问的mstor邮箱可能是:

mstor:C:Microsoft Windows计算机

从本地存储读取邮件上/邮件:

Session session = Session.getDefaultInstance(new Properties()); 

Store store = session.getStore(new URLName("mstor:c:/mailbox/MyStore")); 
store.connect(); 

// read messages from Inbox.. 
Folder inbox = store.getDefaultFolder().getFolder("Inbox"); 
inbox.open(Folder.READ_ONLY); 

Message[] messages = inbox.getMessages(); 
+0

嗨阿隆,当我说store.connect(),它没有连接到在url名称中指定的存储,它连接到一些东西,如mstor:// username @(系统用户名)。 – user972590

+0

我将mstor jar复制到classpath中,我需要进行其他配置吗? – user972590

+0

您需要在类路径中包含mstor,commons-logging和jdom JAR。 –

1
//Remember to add the properties in above code. 

this.properties = new Properties(); 
      this.properties.setProperty("mail.store.protocol", "mstor"); 
      this.properties.setProperty("mstor.mbox.metadataStrategy", "none"); 
      this.properties.setProperty("mstor.mbox.cacheBuffers", "disabled"); 
      this.properties.setProperty("mstor.mbox.bufferStrategy", "mapped"); 
      this.properties.setProperty("mstor.metadata", "disabled"); 
      this.properties.setProperty("mstor.mozillaCompatibility", "enbled")