Question

I am developing a email application and I am holding message classes as files. However, I have some questions about the operation on emails.

For example,

There is a message being held its class as a file but when user want to delete it if I got message class from file and I setted flag as DELETED after that I invoked folder.expunge() method. Would it be successfull?

Or, Do I have to take a instance of that message from Folder class by matching Message-ID header and do delete process?

Was it helpful?

Solution

You have to get the Message object from the Folder. The Message objects you might create by reading a file are in no way connected to the Folder that the data might've come from originally. You'll probably want to keep track of the original folder name (or URL), the folder's UIDVALIDITY value, and the message's UID. With that information you can easily find the corresponding Message object in the Folder, if it still exists.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top