0

I'm trying to develop an e-mail client for android using JavaMail and JavaMaildir. I've downloaded JavaMaildir from here: http://sourceforge.net/projects/javamaildir/, version 0.5.

I've added the .jar file into the libs folder of my android project. The project compiles without problem.

Here is the code I'm using to initialize the store object:

Properties prop = new Properties();
prop.put("mail.store.maildir.autocreatedir", true);
this.session = Session.getInstance(prop);
// Creates the directory if it doesn't exists
File dir = this.getDir(POP3ClientService.md_name, Context.MODE_PRIVATE);
String url = "maildir:" + dir.getAbsolutePath();
Log.d("DEBUG", url);
try {
    this.store = this.session.getStore(new URLName(url));
} catch (NoSuchProviderException e) {
    // TODO Auto-generated catch block
    this.store = null;
    Log.e("ERROR", e.getMessage());
}

http://javamaildir.sourceforge.net/examples/ Which is taken from the example available on the project site: http://javamaildir.sourceforge.net/examples/

Unfortunately, it throws a NoSuchProviderException and therefore I cannot use the store since it's a null pointer.

The error message says No provider for maildir. Where am I wrong?

Zagorax
  • 11,440
  • 8
  • 44
  • 56
  • Is the jar file available at runtime? If you turn on JavaMail session debugging, what does the output show? – Bill Shannon Dec 29 '13 at 04:57
  • @BillShannon, How am I supposed to read the JavaMail session debugging on Android? Is there any way to redirect logs to Logcat? – Zagorax Dec 30 '13 at 14:49
  • Cause I've added `session.setDebug(true)` to my code, but I don't see any extra log line in Logcat, even if it seems it should be automatically redirected to Logcat. – Zagorax Dec 30 '13 at 15:05
  • Sorry, I know nothing about Android. You can always redirect the JavaMail debug output using Session.setDebugOut. – Bill Shannon Dec 31 '13 at 01:37

0 Answers0