I have one mail that seems to have an encoded attachment with invalid Base-64 character(s).
When trying to retrieve the attachment with method GetDataByUID(), I just get null:
BodyStructure structure = ipimap.GetBodyStructureByUID(mailID);
foreach(MimeStructure attachment in structure.Attachments)
{
byte[] buffer = imap.GetDataByUID(attachment);
}
I.e. the buffer is null after the call to GetDataByUID()!
When trying to get the attachment with another mail tool, it responses that:
"Invalid character in a Base-64 string."
I.e. the attachment seems to not be correct.
Is there a way to detect this "invalid character" error with the Mail.dll component?
There seems to be no exceptions thrown from the Mail.dll that I could use.
The log output looks as follows when GetBodyStructureByUID and GetDataByUID is called:
Mail.dll: 9 07:11:09 3.0.14088.1309
Mail.dll: 9 07:11:09 S: * OK The Microsoft Exchange IMAP4 service is ready.
...
Mail.dll: 9 07:14:18 S: * 1 FETCH (UID 882 BODYSTRUCTURE
(("text" "html" ("charset" "iso-8859-1") NIL NIL "quoted-printable"
3748 110 NIL NIL NIL NIL)("application" "octet-stream" NIL "<>" NIL
"base64" 0 NIL ("attachment" ("filename" "facture.pdf")) NIL NIL)
"mixed" ("boundary" "part__95062704_1618_48B1_AC6B_B632A2661") NIL
"fr-FR"))
Mail.dll: 9 07:14:18 S: e73ebe47e99b4c9a OK FETCH completed.
Mail.dll: 9 07:14:18 C: 00631adc3c034c05 UID FETCH 882 (UID BODY[2])
Mail.dll: 9 07:14:18 S: * 1 FETCH (UID 882 BODY[2] NIL FLAGS (\Seen))
Mail.dll: 9 07:14:18 S: 00631adc3c034c05 OK FETCH completed.
The Base-64 encoded attachment, and its size, should be shown in the log instead of NIL, in line:
Mail.dll: 9 07:14:18 S: * 1 FETCH (UID 882 BODY[2] NIL FLAGS (\Seen))