开发者

Javamail IMAP search by SUBJECT fails

I'm using javamail for imap search by subject on Gmail. I use the subjectTerm class to create a searchTerm object and pass to the search function. Search works fine for subject strings which are pure alphanumeric. As soon as I put in a single quote or a dash in the search string the search fails.

IMAPSSLStore imapSslStore = connectToImap("imap.googlemail.com",993,email,oauthToken,oauthTokenSecret,getAnonymousConsumer(),true);

Folder inbox = imapSslStore.getFolder("[Gmail]/All Mail");
inbox.open(Folder.READ_ONLY);

SearchTerm sTerm = new SubjectTerm("String with quote's and da-sh"); //this 开发者_高级运维fails

Message messages[] = inbox.search(sTerm);  //no results found !

Is there a standard way to escape the search string or this is a limitation on gmail's end?


try using this api

http://code.google.com/p/java-gmail-imap/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜