S22.Imap icon indicating copy to clipboard operation
S22.Imap copied to clipboard

GetMessage(), the "text/html" body part need have a high priority

Open yeaicc opened this issue 10 years ago • 4 comments

Sorry my English…… GetMessage(), if i got two body part,I want to get the html part.But,When the first part is plain....i'll can not get the html part.

yeaicc avatar Dec 23 '14 07:12 yeaicc

I came here for this same issue. I just started researching so it's possible there is a way to get the HTML part already

bradbamford avatar Apr 13 '17 13:04 bradbamford

Hello, I found a method to get the body in html of the messages, try this:

 foreach (var currentEmail in imap.GetMessages(uids))
 {
    var currentEmailBody = string.Empty;
    using (var reader = new StreamReader(currentEmail.AlternateViews.FirstOrDefault().ContentStream))
    {
       currentEmailBody = reader.ReadToEnd();
    }
}

viniciusdemorais avatar Jun 09 '20 00:06 viniciusdemorais

Thank you @viniciusdemorais. It worked very well.

AlanDouglasRamos avatar Jan 21 '22 16:01 AlanDouglasRamos

Thanks @viniciusdemorais. that works

chougulevinay avatar Feb 09 '22 08:02 chougulevinay