classpathx-javamail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpathx-javamail] Re: clueless newbie -- how to open mbox?


From: Chris Burdess
Subject: Re: [Classpathx-javamail] Re: clueless newbie -- how to open mbox?
Date: Thu, 3 May 2007 13:59:33 +0100

Matej Cepl wrote:
When (following http://tinyurl.com/ysqmfx ) I tried other
variant, I got back to the square one:

address@hidden kmail2tbfolders]$ cat -b test.java
     1  import java.util.*;
     2  import javax.mail.*;

     3  public class test {
     4          public static void main(String[] args) throws
                MessagingException {
     5                  String urlStr
                        = ``/home/matej/.eclipse/workspace\
            /kmail2tbfolders/examples/``';
     6                  Session session = Session.getInstance(new
                        Properties());
     7                  URLName storeURL = new
                        URLName(``'mbox://``'+urlStr);
     8                  Store store
                        = session.getStore(storeURL);
     9                  Folder test
                        = store.getDefaultFolder();
    10                  test = test.getFolder(``'test``');
    11                  test.open(Folder.READ_WRITE);
    12                  try {    13
                        test.open(Folder.READ_WRITE);
    14          } catch (MessagingException ex) {
    15                  test.open(Folder.READ_ONLY);
    16          }
    17          }
    18  }


You will need to put store.connect() and store.close(), just like with any other JavaMail provider.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]