private string GetMimeContent(string contentType) { var contentTypeParts = contentType.Split('/'); var mime = document.GetMIMEEntity("Body"); if (mime != null) { if (mime.ContentType == "multipart") { var child = mime.GetFirstChildEntity(); while (child != null) { if (child.ContentType == contentTypeParts[0] && child.ContentSubType == contentTypeParts[1]) { return(child.ContentAsText); } var innerChildOrSibling = child.GetFirstChildEntity(); if (innerChildOrSibling == null) { innerChildOrSibling = child.GetNextSibling(); if (innerChildOrSibling == null) { innerChildOrSibling = child.GetParentEntity(); if (innerChildOrSibling != null) { innerChildOrSibling = innerChildOrSibling.GetNextSibling(); } } } child = innerChildOrSibling; } } else { return(mime.ContentAsText); } } return(""); }