Skip to content

MailKit.Net.Imap.ImapProtocolException : 'Syntax error in BODY. Unexpected token: ')'' #1841

@bleece

Description

@bleece

Describe the bug
When I try to fetch messages "client.Inbox.Fetch(startIndex, -1, request, cancel.Token);" I got error

Platform (please complete the following information):
Microsoft.NETCore.App.Ref\7.0.20

Exception
à MailKit.Net.Imap.ImapUtils.ReadStringToken(ImapEngine engine, String format, CancellationToken cancellationToken)
à MailKit.Net.Imap.ImapUtils.ParseContentType(ImapEngine engine, String format, CancellationToken cancellationToken)
à MailKit.Net.Imap.ImapUtils.ParseBody(ImapEngine engine, String format, String path, CancellationToken cancellationToken)
à MailKit.Net.Imap.ImapUtils.ParseBody(ImapEngine engine, String format, String path, CancellationToken cancellationToken)
à MailKit.Net.Imap.ImapUtils.ParseMultipart(ImapEngine engine, String format, String path, CancellationToken cancellationToken)
à MailKit.Net.Imap.ImapFolder.ParseSummaryItems(ImapEngine engine, MessageSummary message, FetchSummaryItemsCompletedCallback completed, CancellationToken cancellationToken)
à MailKit.Net.Imap.ImapFolder.UntaggedFetchSummaryItemsHandler(ImapEngine engine, ImapCommand ic, Int32 index, Boolean doAsync)
à MailKit.Net.Imap.ImapEngine.ProcessUntaggedResponse(CancellationToken cancellationToken)
à MailKit.Net.Imap.ImapCommand.Step()
à MailKit.Net.Imap.ImapEngine.Iterate()
à MailKit.Net.Imap.ImapEngine.Run(ImapCommand ic)
à MailKit.Net.Imap.ImapFolder.Fetch(Int32 min, Int32 max, IFetchRequest request, CancellationToken cancellationToken)
à AlloVoisins.IdleClient.d__26.MoveNext() dans **\IdleClient.cs :ligne 95

To Reproduce
Steps to reproduce the behavior:
IList? fetched = null;
fetched = client.Inbox.Fetch(startIndex, -1, request, cancel.Token);

Expected behavior
Get all messages

client = new ImapClient(new ProtocolLogger(Console.OpenStandardError()));

     async Task ReconnectAsync()
     {
         if (!client.IsConnected)
             await client.ConnectAsync(_host, _port, sslOptions, cancel.Token);

         if (!client.IsAuthenticated)
         {
             await client.AuthenticateAsync(_gmailUsername, _gmailPassword, cancel.Token);
             await client.Inbox.OpenAsync(FolderAccess.ReadOnly, cancel.Token);
         }
     }


 IList<IMessageSummary>? fetched = null;
 fetched = client.Inbox.Fetch(startIndex, -1, request, cancel.Token);

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityCompatibility with existing softwareserver-bugThe bug appears to be in the serverserver/gmailGoogle Mail

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions