Anonymous posting is allowed. We will try to reply to your posts as soon as possible. Another members are encouraged to reply to new users.
If you specify your email in the posted message, it will be masked. You will receive notification when someone replies to your post.
NOTE: we are slowly moving interesting forum posts to our Knowledge base so if you see posts deleted - you know where to find them.
Hello, We are trying to use wodImapServer and a bit confused with a logic of ReadMessage and ListMessages methods. In your examples you didn`t use ReadMessage at all.
As I understand, ImapServer has to be able to send to user information about messages with certain detail level. Whole messages or only headers. So, that when user connects, first he has to retrieve the list of messages headers for folder. Than, when navigate to certain message, retrieve whole message with body. But we are not able to understand how to implement that logic using ReadMessage and ListMessages. When and how to load only headers and when whole message.
So, the first approach is to load whole messages in ListMessages. But in our case that is not efficient. Messages in our system are saved not in eml files, but in different tables and to create a whole eml representation of message we have to do a lot of workaround, which is time and resources consuming. It is much more quicker to load only headers first (it is very easy in our case), and load only message body when it is really necessary. How it could be implemented? In ListMessages load only headers and in ReadMessage whole eml? Or what?
Yes, that's correct. When ReadMesage event is triggered, then the message Body is requested. This means that you should load the actual message body at this time if you haven't done so yet.
As for ListMessages, it fires when message list is requested. This is where you can populate headers.
Than several more questions: 1) So in ListMessage event we have to load only headers. How to load only header in ImapMessage object? ImapMessage.Headers is a readonly. We have a subject, to, from addresses and so on as strings. 2) In ReadMessage we have to load message body. How to detect that message body is not loaded? And what is a right way to load only message body if headers are loaded? Thanks
1) You simply fill in the Body property with Headers only 2) You can check if Text property contains anything, or thru Parts collection (for multi-part messages). Then you can simply append the message text to already populated (with headers) Body property.