/// <summary>
 /// Creates an empty child MIME entity from the parent MIME entity.
 /// 
 /// An email can consist of several MIME entities. A entity has the same structure
 /// like an email, that is header and body. The child inherits few properties 
 /// from the parent as default value.
 /// </summary>
 public RxMailMessage CreateChildEntity() {
   RxMailMessage child = new RxMailMessage();
   child.Parent = this;
   child.TopParent = this.TopParent;
   child.ContentTransferEncoding = this.ContentTransferEncoding;
   return child;
 }
    private void decodeEntity(RxMailMessage entity) {
      AppendLine("From  : {0}", entity.From);
      AppendLine("Sender: {0}", entity.Sender);
      AppendLine("To    : {0}", entity.To);
      AppendLine("CC    : {0}", entity.CC);
      AppendLine("ReplyT: {0}", entity.ReplyTo);
      AppendLine("Sub   : {0}", entity.Subject);
      AppendLine("S-Enco: {0}", entity.SubjectEncoding);
      if (entity.DeliveryDate>DateTime.MinValue) {
        AppendLine("Date  : {0}", entity.DeliveryDate);
      }
      if (entity.Priority!=MailPriority.Normal) {
        AppendLine("Priori: {0}", entity.Priority);
      }
      if (entity.Body.Length>0) {
        AppendLine("Body  : {0} byte(s)", entity.Body.Length);
        AppendLine("B-Enco: {0}", entity.BodyEncoding);
      } else {
        if (entity.BodyEncoding!= Encoding.ASCII) {
          AppendLine("B-Enco: {0}", entity.BodyEncoding);
        }
      }
      AppendLine("T-Type: {0}", entity.TransferType);
      AppendLine("C-Type: {0}", entity.ContentType);
      AppendLine("C-Desc: {0}", entity.ContentDescription);
      AppendLine("C-Disp: {0}", entity.ContentDisposition);
      AppendLine("C-Id  : {0}", entity.ContentId);
      AppendLine("M-ID  : {0}", entity.MessageId);
      AppendLine("Mime  : Version {0}", entity.MimeVersion);
      if (entity.ContentStream!=null) {
        AppendLine("Stream: Length {0}", entity.ContentStream.Length);
      }

      //decode all shild MIME entities
      foreach (RxMailMessage child in entity.Entities) {
        mailStructure.AppendLine("------------------------------------");
        decodeEntity(child);
      }

      if (entity.ContentType!=null && entity.ContentType.MediaType!=null && entity.ContentType.MediaType.StartsWith("multipart")) {
        AppendLine("End {0}", entity.ContentType.ToString());
      }
    }
    public List<string> UnknowHeaderlines; //


    // Constructors
    // ------------
    /// <summary>
    /// default constructor
    /// </summary>
    public RxMailMessage() {
      //for the moment, we assume to be at the top
      //should this entity become a child, TopParent will be overwritten
      TopParent = this; 
      Entities = new List<RxMailMessage>();
      UnknowHeaderlines = new List<string>();
    }