-
-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MailKit.Net.Imap.ImapProtocolException : 'Syntax error in BODY. Unexpected token: ')'' #1841
Comments
I'm going to need the IMAP protocol log (which was dumped to the console - just copy & paste it here) |
Hello,
|
I probably won't be able to get to this this week, but I should have time this weekend/next week to dig into this. I suspect the issue is with: MailKit likely expects more tokens after the I have to verify the syntax, but I'm pretty sure that the syntax specifies that there must be a few more tokens there such as the Content-Type parameters and some of the other Content-* header values (Location, Language, etc). |
Ok, thanks for your feedback. I look forward to hearing from you. Have a good evening. |
What version of MailKit are you using? I am not able to reproduce this. |
I am using 4.8.0 |
Thanks. I'll try taking another look at this. |
Does this happen every time? What if you change your requested items to just I'm wondering if there's a buffering issue because I still can't reproduce this. |
|
If I feed your log into my unit test, it parses the BODY response just fine. No exceptions. |
my last log : |
I can repro now - I'll look at debugging it this weekend. |
Great, thanks! |
I found the issue:
Specifically, this: Now comes the hard part in trying to figure out how to interpret that because it's nonsensical. It's clearly meant to be an empty I wonder if you could do |
Another thing to try, in the meantime, would be to use They more-or-less give you the exact same info (BodyStructure gives you slightly more info), but sometimes IMAP servers use different implementations and it's possible that the BODYSTRUCTURE response will be syntactically valid while the BODY response is not. Just something worth trying. |
…VE")` Similar workaround to BODYSTRUCTURE responses that we already had. Fixes issue #1841
Looks like I already had a work-around for GMail's BODYSTRUCTURE response that did something similar. |
Thanks. I'll watch this weekend. |
Release might get delayed a few days by a last-minute MimeKit feature that needs a bit of testing. Will update you in the comments when v4.9.0 goes out. |
Released v4.9.0 |
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
The text was updated successfully, but these errors were encountered: