- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 838
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
Syntax error in BODY. Unexpected token: ')' #1430
Comments
Okay, so it looks like this is the problematic response from the server:
Notice how after the MailKit's ImapClient is reading that In other words, the IMAP protocol uses key/value pairs in the responses and in this case, the This is technically a server bug since it is skipping the value token but I'll try to think of a way to better handle this type of scenario. FWIW, one of the things I am considering is moving toward a Telemetry-based system that provides me info about these types of situations so that I can figure out work-arounds for these server bugs and then have the code handle them by skipping until the end of the line and just dropping that particular response and proceeding normally (i.e. not throwing an ImapProtocolException). I'm not sure how the MimeKit/MailKit developer base (and their respective user-bases) feels about that, though, and it would also mean I'd have to start taking dependencies on other NuGet packages. I'm also not sure if I'd be able to report telemetry that would provide enough context w/o having to push user-sensitive data (most people, when they report ImapProtocolExceptions like you did, will manually scrub the log data of any sensitive info). Anyway, just some of stuff I've been thinking about... |
@jstedfast Can you tell me if it is possible to ignore such emails? So that I found another similar letter:
I don't know why, but they lost the body of the message, although these are the |
Unfortunately, it's not currently possible (hence my thoughts about using Telemetry and making MailKit just drop non-parsable responses). I've heard about a lot of Yandex bugs unfortunately :-( The original bug was with GMail, though, right? Either way I'll try to find a solution, but one of the things I do is add a comment about which server(s) had the bug and/or implement a "Quirks Mode" for that server (see the ImapQuirksMode enum in ImapEngine.cs). |
Yes - Gmail |
Theoretically, this should fix issue #1430
I just implemented a potential fix for this. It doesn't work around the broken response, but it does avoid requesting preview text if the body is 0 bytes long which is what I think is causing GMail to send that broken response. |
Try the latest build from https://www.myget.org/feed/mimekit/package/nuget/MailKit and see if that works |
@jstedfast Yes, everything works fine. Thank you :) |
You're welcome! |
Was reading the release notes and came across this, just my 2 cents, i'd be against telemetry in the main package, it seems intrusive. A whole opt-in seperate package would be a-ok, i wouldn't personally install it before having issues though. |
This is why I probably won't bother. The problem with having telemetry be opt-in and have it in a second package is that that's what everyone would do - no one would opt-in until/unless they hit a problem. At that point, they can just send me the logs. The ProtocolLogger already redacts credentials. This also avoids having to have a cloud database which avoids incurring extra costs to myself. |
Hello, still having this Problem with some letters: Syntax error in BODY. Unexpected token: ')' at MailKit.Net.Imap.ImapFolder.FetchStreamAsync(ImapEngine engine, ImapCommand ic, Int32 index, Boolean doAsync) Mailkit Version 4.3.0, mail server - Yandex |
@sq5 please file a new issue and include a protocol log, otherwise there's nothing I can do. |
Describe the bug
Hello. I have an old email with a reminder for a certain date sent using Gmail, once there was a normal email with an HTML body, but now for some reason it has disappeared and only the attached files remain.
When trying to execute
folder.FetchAsync
withfetchRequest(Message Summary Items.Full | Message Summary Items.UniqueId | MessageSummaryItems.PreviewText)
an exception occurs (MessageSummaryItems.PreviewText
).Exception
Platform (please complete the following information):
The text was updated successfully, but these errors were encountered: