var myattachments = new List<MimePart>(); var multiparts = new List<Multipart>(); from received mail. <pre> using (var iter = new MimeIterator(email)) { while (iter.MoveNext()) { var multipart = iter.Parent as Multipart; var part = iter.Current as MimePart; if (multipart != null && part != null && part.IsAttachment) { multiparts.Add(multipart); myattachments.Add(part); } } } for (int i = 0; i < myattachments.Count; i++) multiparts[i].Remove(myattachments[i]);
c# - Displaying message body from MIME encoded email string - Stack Overflow[^]: There are multiple ways to get the message body: Traversing the MIME tree manually ... (Difficulty: Extreme)Using a MimeIterator ... (Difficulty: Extreme)Using a MimeVisitor subclass to traverse the MIME tree structure ... (Difficulty: Moderate)... use the MimeMessage.TextBody and/or MimeMessage.HtmlBody properties. (Difficulty: Easy Mode)
MimeIterator
MimeVisitor
MimeMessage.TextBody
MimeMessage.HtmlBody
HtmlBody
TextBody
Body
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)