0

我正在尝试使用 JavaMail 和 JavaMaildir 为 android 开发电子邮件客户端。我已经从这里下载了 JavaMaildir:http: //sourceforge.net/projects/javamaildir/,版本0.5

我已将该.jar文件添加到libs我的 android 项目的文件夹中。该项目编译没有问题。

这是我用来初始化存储对象的代码:

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/ 取自项目站点上可用的示例:http: //javamaildir.sourceforge.net/examples/

不幸的是,它抛出了 a NoSuchProviderException,因此我不能使用存储,因为它是一个空指针。

错误消息说No provider for maildir。我哪里错了?

4

0 回答 0