0

The Android application I'm working on right now is to search for the keywords "friend" and "important" in the mail(specifically in the subject and content) received in the inbox for the email given, which is implemented using IMAP to connect and read data of the email.

I have implemented the IMAP protocol to read mails, it reads the emails perfectly fine. However, I am having a problem searching for keywords in emails, I have tried implementing the horse pool String match algorithm, but it doesn't work as intended, so I scrapped it. Is there another way to search for keywords in an email(keywords in the subject and content)?

Is there an inbuilt search algorithm or are there more efficient ways to implement this?

Ashwin Praveen
  • 661
  • 2
  • 10
  • 20
  • There's an IMAP command, e.g. "uid search or or body friend body important or subject friend subject important" in this case. (IMAP uses prefix, as you can see, so "or x y" means the same as the more common "x or y".) – arnt Oct 31 '15 at 10:37
  • @arnt I am implementing this on Android, could you illustrate how the command is used? – Ashwin Praveen Oct 31 '15 at 12:40
  • Depends what library you use, if any. https://github.com/k9mail/k-9/tree/master/k9mail/src/main/java/com/fsck/k9/search is one codebase, http://stackoverflow.com/search?q=javamail%20search shows questions and answers related to another. – arnt Oct 31 '15 at 14:16

0 Answers0