Closed sq5 closed 4 months ago
These types if exceptions are typically due to a syntax error in the server response.
What I need from you is a protocol log. Specifically, the last response from the server when you get this exception.
You can get a protocol log by passing in a new ProtocolLogger ("imap.log")
to the ImapClient constructor like this:
var client = new ImapClient (new ProtocolLogger ("imap.log"));
Here's the problem:
S: * 1 FETCH (UID 3016 BODY[2.MIME] {389}
S: Content-Disposition: attachment;
S: filename="=?UTF-8?B?0KHRh9C10YIg0LTQtCDQotC+0L8t0JrQvtGE0LUg0YPQuy4g0KPRgNCw0LvRjNGB0LrQsNGPLCDQtC4x?=
S: =?UTF-8?B?INC90L7Rj9Cx0YDRjC5wZGY=?="
S: Content-Transfer-Encoding: base64
S: Content-Type: application/pdf;
S: name="=?UTF-8?B?0KHRh9C10YIg0LTQtCDQotC+0L8t0JrQvtGE0LUg0YPQuy4g0KPRgNCw0LvRjNGB0LrQsNGPLCDQtC4x?=
S: =?UTF-8?B?INC90L7Rj9Cx0YDRjC5wZGY=?="
S:
S: BODY[2] )
See the BODY[2]
? IMAP responds with key/value pairs. In this case, it gives us a key (BODY[2]
), but no corresponding value.
A correct response would be any of the following:
S: * 1 FETCH (UID 3016 BODY[2.MIME] {389}
S: Content-Disposition: attachment;
S: filename="=?UTF-8?B?0KHRh9C10YIg0LTQtCDQotC+0L8t0JrQvtGE0LUg0YPQuy4g0KPRgNCw0LvRjNGB0LrQsNGPLCDQtC4x?=
S: =?UTF-8?B?INC90L7Rj9Cx0YDRjC5wZGY=?="
S: Content-Transfer-Encoding: base64
S: Content-Type: application/pdf;
S: name="=?UTF-8?B?0KHRh9C10YIg0LTQtCDQotC+0L8t0JrQvtGE0LUg0YPQuy4g0KPRgNCw0LvRjNGB0LrQsNGPLCDQtC4x?=
S: =?UTF-8?B?INC90L7Rj9Cx0YDRjC5wZGY=?="
S:
S: BODY[2] "")
or
S: * 1 FETCH (UID 3016 BODY[2.MIME] {389}
S: Content-Disposition: attachment;
S: filename="=?UTF-8?B?0KHRh9C10YIg0LTQtCDQotC+0L8t0JrQvtGE0LUg0YPQuy4g0KPRgNCw0LvRjNGB0LrQsNGPLCDQtC4x?=
S: =?UTF-8?B?INC90L7Rj9Cx0YDRjC5wZGY=?="
S: Content-Transfer-Encoding: base64
S: Content-Type: application/pdf;
S: name="=?UTF-8?B?0KHRh9C10YIg0LTQtCDQotC+0L8t0JrQvtGE0LUg0YPQuy4g0KPRgNCw0LvRjNGB0LrQsNGPLCDQtC4x?=
S: =?UTF-8?B?INC90L7Rj9Cx0YDRjC5wZGY=?="
S:
S: BODY[2] NIL)
or
S: * 1 FETCH (UID 3016 BODY[2.MIME] {389}
S: Content-Disposition: attachment;
S: filename="=?UTF-8?B?0KHRh9C10YIg0LTQtCDQotC+0L8t0JrQvtGE0LUg0YPQuy4g0KPRgNCw0LvRjNGB0LrQsNGPLCDQtC4x?=
S: =?UTF-8?B?INC90L7Rj9Cx0YDRjC5wZGY=?="
S: Content-Transfer-Encoding: base64
S: Content-Type: application/pdf;
S: name="=?UTF-8?B?0KHRh9C10YIg0LTQtCDQotC+0L8t0JrQvtGE0LUg0YPQuy4g0KPRgNCw0LvRjNGB0LrQsNGPLCDQtC4x?=
S: =?UTF-8?B?INC90L7Rj9Cx0YDRjC5wZGY=?="
S:
S: BODY[2] {0}
S: )
I'll see what I can do about adding a work-around.
Discussed in https://github.com/jstedfast/MailKit/discussions/1707