Re: Help needed gnu classpathx mail
Chris Burdess <[email protected]> Tue, 30 Dec 2003 15:32:49 +0000
| Newsgroups | gmane.comp.java.classpath.extensions.discuss |
|---|---|
| Message-ID | <[email protected]> |
Chris wrote:
> I can't figure out how to use the mbox mail provider. I'm new to java
> mail API for reading mail boxes, but it seems to me that a provider
> should provide a subclass of the "javax.mail.Provider" class, which the
> gnuclasspathx providers don't seem to do.
no. a provider provides subclasses of the Store and/or Transport
classes. the Provider class is simply a convenience class to tell you
which providers are registered; it shouldn't be subclassed.
> Has anyone got some example code?
how about:
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
URLName url = new URLName("mbox:///home/chris/mail");
Store store = session.getStore(url);
Folder root = store.getDefaultFolder();
Folder mymailbox = root.getFolder("mymailbox.mbox");
for further information, read the javamail documentation and the javadoc
for the mbox provider.
--
Chris Burdess