This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Mail IMAP search taking lot of time when there are lot of messages in mail box.  RSS feed

jai kisan
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have written a scheduler to run every one minute and use IMAP (SSL) API to get all unread messages and then mark only 200 messages from it as read and then read content of each message (200) one by one. Issue I am facing is when mail box is having around 400k messages (100GB) the first command to get unread messages itself taking more than 10 mins. I am not sure if this is how imap behaves or is it something slow at mailbox or network level. Eventually my target is to read around 500k emails in 24 hours from mail box where one message will be of around 250kb and then store each HTML message in oracle DB as blob. Currently I am no where near to achieve this target. I am attaching my code below. It is processing only 50 messages in a minute. I would really appreciate if some one can guide me to fix any performance issues in my code. Also if some has experience of extracting HTML email from mail box and persisting in database using any way, It would be really helpful if you can share your knowledge. Thanks!

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!