Hi Jm,
Thanks for the details, but sorry I still could not reproduce the Chinese like characters behavior using ImapClient class. I tried with a locally installed IMAP server as well as IMAP service of MS Exchange. What I did with the messages is that I first added these to the Outlook Inbox which in turn synced these messages with the IMAP server. Then I used ImapClient to fetch these messages and converted to TIF.
Could you please test the following , as you already noticed if these are saved in EML/MSG, they work correctly.
public IIncomingMessage GetMessage(string pendingMessage) {
MailMessage mailMessage;
EMailBodyFormat bodyFormat=EMailBodyFormat.PlainText;
IList<string> lstAttachments=new List<string>();
using(ImapClient imapClient=GetClient()) {
imapClient.SelectFolder(“INBOX”);
mailMessage=imapClient.FetchMessage(pendingMessage);
// Update here
MemoryStream stream = new MemoryStream();
mailMessage.Save(stream, MailMessageSaveType.EmlFormat);
stream.Position = 0;
mailMessage = null;
mailMessage = MailMessage.Load(stream, MessageFormat.Eml);
// End update
imapClient.Disconnect();
}
if(null==mailMessage) {
return null;
}
if(mailMessage.IsBodyHtml) {
bodyFormat=EMailBodyFormat.Html;
}
int attachmentNumber=0;
foreach(Attachment attachment in mailMessage.Attachments) {
attachmentNumber++;
string attachmentName=ScrubFileName(attachment.Name, attachmentNumber);
lstAttachments.Add(attachmentName);
}
IPendingMessage message=new PendingMessage(pendingMessage);
IncomingMessage incomingMsg=new IncomingMessage(mailMessage, message, bodyFormat, lstAttachments);
return incomingMsg;
}