Hello there, I always get an error if i call GetMessageInfo directly after StoreMessage-Method with returned UniqueID as parameter. Here's my code snippet.

Dim sMessageUniqueID As String = oImap.StoreMessage(oImap.CurrentFolder.Name, oMailMessage)

' now we want to get the "new" message id from stored message

Dim oImapMessageInfo As ImapMessageInfo = oImap.GetMessageInfo(sMessageUniqueID, ImapListFields.Fast)

-> Exception: "Message not found."

thank you in advance and have a nice day

asked 23 Mar '11, 08:19

martin's gravatar image

martin
745
accept rate: 0%

It looks like your code is OK, the message should have been found. Please use Imap object's LogWriter property to create a log of communication (as described at http://www.rebex.net/kb/logging.aspx) and either mail it to us (support@rebex.net) for analysis or edit your question to include it. We should be able to tell what is going on then.

(24 Mar '11, 14:48) Lukas Pokorny ♦♦

According to the log you sent us, you are using Courier IMAP server and we have been able to reproduce the same issue on it. Calling Imap object's CheckForUpdates method after StoreMessage appears to solve it:

Dim sMessageUniqueID As String = oImap.StoreMessage(oImap.CurrentFolder.Name, oMailMessage)

' force the server to send message status updates
oImap.CheckForUpdates();

' now we want to get the "new" message id from stored message
Dim oImapMessageInfo As ImapMessageInfo = oImap.GetMessageInfo(sMessageUniqueID, ImapListFields.Fast)

This is not needed on most IMAP servers which send the message status updates before the APPEND command (used by StoreMessage method) completes.

We will consider doing this automatically in one of the future releases of Rebex Mail.

link

answered 25 Mar '11, 08:43

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.4k28
accept rate: 31%

ok, that works. thank you very much.

but which ImapListFields-option is the minimum to get the message id?

(25 Mar '11, 10:13) martin

What do you mean by message ID, exactly? ImapListFields.SequenceNumber is all you need to get message's sequence number, ImapListFields.UniqueID is all you need to get its unique ID (but you already have that one in sMessageUniqueID. If you would rather have the protocol-level ID instead of its Rebex-only string representation, use ImapMessageSet.ParseUniqueId to parse the sMessageUniqueID into its two parts.

(25 Mar '11, 13:58) Lukas Pokorny ♦♦

o sorry. i mean the ImapMessageInfo.MessageId.Id, like 4D7B56BF.8060902@arcor.de

if i use ImapListFields.Fast I did not get it

(25 Mar '11, 14:01) martin

I forgot that one, sorry! You need ImapListFields.Envelope to get this MessageId.

(25 Mar '11, 14:45) Lukas Pokorny ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×76
×17

Asked: 23 Mar '11, 08:19

Seen: 621 times

Last updated: 25 Mar '11, 08:43