Pancham Kumar
Pancham Kumar

Reputation: 175

fasteR searching for specfic mail on mail server using java mail api

Is there any way to do search faster for mail matching certain criteria using java mail API? I have used FetchProfile and folder.search(), but it takes long time, when there is huge chunk of messages on the mail server.

Upvotes: 0

Views: 677

Answers (1)

Bill Shannon
Bill Shannon

Reputation: 29961

If you're using IMAP and Folder.search, all the searching should be done on the server. How fast the search is depends on your server, the complexity of the search, etc. You can turn on JavaMail debugging to see the exact IMAP commands sent to the server and the server's response. If you measure the time of just the Folder.search call, and the call is sending the expected IMAP SEARCH command, then you're doing the best you can.

Upvotes: 2

Related Questions