I'm working on an application server that uses mail servers via the JAVAMail API. I want to add a cache mechanism for messages, that can store (in memory / filesystem / DB) messages that were already read by the user. Can I use the JAVAMail API when not connected to the mail storage?
Can I use the JAVAMail API when not connected to the mail storage
No. Well, you can't use any of its features when not connected to a server. However, you could write a program which periodically connects to the server to get any new messages.
Thanks, but I don't see how it helps. I don't need to cache new messages, I need to cache already seen messages.
I thought about extending the Message class, and simply imitate its functionality by saving the actual content as byte[]. But this seems to be very complicated, as this causes me to re-write all of the JAVAMail API without the mail store part... ;-)
Well, that's your only rtoute I'm afraid. You might want to hunt around places like sourceforge to see if someone has not already written this. Sounds like something that someone might have.