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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With