It looks like MessageContent.cs is using regex to try and extract the message content, but it's not working properly.
Probably the IMAP server is putting the requested items in a different order than what the regex expects, e.g. the regex expects the UID to be the first item, but the server is probably responding with the BODY first or something.
This is something that is really hard to parse correctly with regex because it's a bit like a JSON response in the sense that key/value pairs can come in any order + the fact that values can be a NIL, quoted-string, or a literal string.
For example, the server can respond with any of the following:
This is what makes using regex so complicated for this task :-\
Probably the IMAP server is putting the requested items in a different order than what the regex expects, e.g. the regex expects the UID to be the first item, but the server is probably responding with the BODY first or something.
This is something that is really hard to parse correctly with regex because it's a bit like a JSON response in the sense that key/value pairs can come in any order + the fact that values can be a NIL, quoted-string, or a literal string.
For example, the server can respond with any of the following:
* 1 FETCH (UID 27) (BODY {#}
<content>) IMAPX33 OK UID FETCH completed
or* 1 FETCH (BODY {#}
<content>) UID 27
IMAPX33 OK UID FETCH completed
or* 1 FETCH (UID 27) (BODY NIL) IMAPX33 OK UID FETCH completed
or* 1 FETCH (UID 27) (BODY "hello") IMAPX33 OK UID FETCH completed
Generally IMAP servers will use the literal string format (e.g. {#} ...) for message bodies, but if the message is empty, they might use NIL
or they might use ""
.This is what makes using regex so complicated for this task :-\