Pls help with wodImapServer - WeOnlyDo Discussion board

Pls help with wodImapServer (General questions)

by bkv, Wednesday, December 16, 2009, 14:41 (5455 days ago)

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.

Thanks in advanced,
Konstantin


Re: Pls help with wodImapServer

by woddrazen, Wednesday, December 16, 2009, 16:01 (5455 days ago) @ bkv

Hi Konstantin,


I suppose you are using 2. Full VB6 sample.

Inside that sample full messages are loaded in ListMessages Event using msg.FileName Property.

So there is no need to load separately message header because full message is loaded already including message header.

When client request headers for listing messages wodImapServer pass that part.

When full message body is required wodImapServer send full message body to client.

Hope I helped.


Regards,
Drazen

Re: Pls help with wodImapServer

by bkv, Wednesday, December 16, 2009, 22:06 (5455 days ago) @ woddrazen

Hello,
Thank you for quick response.

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?

Re: Pls help with wodImapServer

by wodDamir, Wednesday, December 16, 2009, 22:31 (5455 days ago) @ bkv

Konstantin,

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.

Hope this helps.

Reagards,
Damba

Re: Pls help with wodImapServer

by bkv, Thursday, December 17, 2009, 10:21 (5454 days ago) @ wodDamir

Hello,

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

Re: Pls help with wodImapServer

by wodDamir, Thursday, December 17, 2009, 12:30 (5454 days ago) @ bkv

Konstantin,

Let me try answering:

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.

Hope this helps.

Regards,
Damba

Re: Pls help with wodImapServer

by bkv, Thursday, December 17, 2009, 14:14 (5454 days ago) @ wodDamir

Hello,

Thanks, seems it is clear now.
I will revert with some questions after testing. :)

Thanks, Konstantin