For several years now, TIdIMAP4 has suffered from a serious design flaw. Internally, when parsing and generating email messages via TIdMessage, the core parser inside of TIdMessage assumes that input data is always escaped using SMTP-style dot transparency, and always produces SMTP-style dot transparent output. This logic is fine for TIdMessage usage in TIdSMTP and TIdPOP3, but the IMAP protocol does not use such transparency, so this can cause malformed and/or truncated messages in TIdIMAP4. A workaround (not a final solution, as that would require additional interface changes in TIdMessage and TIdMessageClient) has now been imeplemented to address some of this issue. When downloading an email, TIdIMAP4.InternalRetrieve() will no longer assume SMTP-style dot transparent input. When storing an email, TIdIMAP4.AppendMsg() will no longer generate SMTP-style dot transparent output.
Note: at this time, the TIdIMAP4.ReceiveBody() method still assumes SMTP-style dot transparent input, and the TIdIMAP4.(UID)RetrieveNoDecodeTo…() methods still produce SMTP-style dot transparent output. I am not sure if/how these methods are being used, so I did not want to break them yet.