jstedfast/MailKit

Syntax error in BODYSTRUCTURE. Unexpected atom token: 9.3736e+06

Closed this issue · 3 comments

Describe the bug
A clear and concise description of what the bug is.

Platform (please complete the following information):

  • OS: Windows
  • .NET Framework: 4.7.1
  • MailKit Version: 4.8.0

Exception

MailKit.Net.Imap.ImapProtocolException: Syntax error in BODYSTRUCTURE. Unexpected atom token: 9.3736e+06
   в MailKit.Net.Imap.ImapEngine.ParseNumber(ImapToken token, Boolean nonZero, String format, Object[] args)
   в MailKit.Net.Imap.ImapUtils.<ReadNumberAsync>d__25.MoveNext()

To Reproduce
Exception occures when trying to fetch all messages.

Code Snippets

            var messages = this.client.Inbox.Fetch(0, -1,
                MessageSummaryItems.Envelope | MessageSummaryItems.UniqueId | MessageSummaryItems.Flags | MessageSummaryItems.BodyStructure,
                headers).ToArray();

The problem is that your IMAP server responded to a query that should have sent a numeric integer value, but instead sent 9.3736e+06. In other words, your IMAP server is buggy.

@IChayka are you also connecting to mail.ru?

I'm not going to support mail.ru because it appears to be a garbage IMAP server. (see #1234 for an example of an unfixable mail.ru issue)

The number of work-arounds I have already had to implement for mail.ru + the fact that it does not support any SEARCH criteria just goes to show it's not worth the effort to support it at all.

See also: https://ru.stackoverflow.com/questions/289544/mail-ru-imap-unsupported-search-criterion