简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM