2
var summaries = IMailFolder.Fetch(
                            uids,
                            MessageSummaryItems.UniqueId |
                            MessageSummaryItems.Envelope |
                             MessageSummaryItems.BodyStructure |
                            MessageSummaryItems.Flags);

One particular email is returning Envelope.MessageId as null. Looking into Gmail the message id is:

<1300932178.eb40.USPR.1342897.1764162864MSOSI1:43OSIMS@myusairways.com>

is this a bug or this is not the right way to get the message id?

Samuel
  • 1,949
  • 4
  • 18
  • 30
  • BTW: MessageId is coming correctly if I include MessageSummaryItems.Headers. However, because I am getting information for tens of thousands of emails, I want to keep the payload to the minimum. – Samuel Apr 24 '19 at 18:43
  • I think it might have confused with the ":" in the message id... – Samuel Apr 24 '19 at 18:51
  • ':' is not a legal character to have in a msgid token. – jstedfast Apr 25 '19 at 17:18

1 Answers1

0

That is the correct way to get the Message-Id value, but as you noticed, the Message-Id header value contains an illegal character.

That said, try to get a protocol log to figure out if your IMAP server is sending the Message-Id header value in the ENVELOPE response or not.

If it is, submit a bug report to https://github.com/jstedfast/MimeKit/issues and I will work on a fix.

Update: Try using https://www.myget.org/feed/mimekit/package/nuget/MimeKit - just make sure to install a version >= 2.1.4.5

jstedfast
  • 35,744
  • 5
  • 97
  • 110