private static void AddChildPartsToParent(MailMessageParser child, MailMessageParser parent)
{
////add the child itself to the parent
parent.Entities.Add(child);
////add the alternative views of the child to the parent
if (null != child.AlternateViews)
{
foreach (AlternateView childView in child.AlternateViews)
{
parent.AlternateViews.Add(childView);
}
}
////add the body of the child as alternative view to parent
////this should be the last view attached here, because the POP 3 MIME client
////is supposed to display the last alternative view
if (child.MediaMainType == ServiceConstants.TEXT_MEDIA_MAIN_TYPE && null != child.ContentStream && null != child.Parent.ContentType && child.Parent.ContentType.MediaType.ToUpperInvariant() == ServiceConstants.MULTI_PART_MEDIA_TYPE)
{
AlternateView thisAlternateView = new AlternateView(child.ContentStream);
thisAlternateView.ContentId = RemoveBrackets(child.ContentId);
thisAlternateView.ContentType = child.ContentType;
thisAlternateView.TransferEncoding = child.ContentTransferEncoding;
parent.AlternateViews.Add(thisAlternateView);
}
////add the attachments of the child to the parent
if (null != child.Attachments)
{
foreach (Attachment childAttachment in child.Attachments)
{
parent.Attachments.Add(childAttachment);
}
}
}