0 votes

We are using IMAP part of Mail.dll version 3.0.13092.1409

If I receive email message with the following characteristics:
mimeStructure is a result of the call to client.GetMessageInfoByUID(messageUid)
mimeStructure.BodyStructure.Text.Size = 0
mimeStructure.BodyStructure.Text.ContentTransferEncoding = 7bit

And call client.GetMimePartByUID(messageUid, mimeStructure)
it throws ArgumentNullException.

If ContentTransferEncoding is "quoted-printable" the problem doesn't exists.

Currently we made temporary workaround with the following sample code:


var msgInfo = client.GetMessageInfoByUID(messageUid);
var mimeStructure = msgInfo.BodyStructure.Text ?? msgInfo.BodyStructure.Html;
if (mimeStructure != null) {
try {
var bodyBytes = client.GetMimePartByUID(messageUid, mimeStructure);
var bodyText = mimeStructure.Encoding.GetString(bodyBytes);
imm.BodyPlainText = bodyText;
} catch (Exception ex) {
// Code to handle (possibly Size=0 + ContentTransferEncoding=7bit) exception...
}
}

Is this problem fixed in newer versions of Mail.dll ?
by

1 Answer

0 votes

As we don't have access to your mailbox and you are using quite old version of Mail.dll .Net IMAP component, the easiest way to test would be to download the latest version at:
https://www.limilabs.com/mail/download

Please let me know, if the problem is still there. Logs would be very helpful:
https://www.limilabs.com/blog/logging-in-mail-dll

by (297k points)
...