private MailMimeMessage AddAlternateView(MimeReader reader)
        {
            var alternateView = new AlternateView(new MemoryStream(reader.GetContent(), false), reader.ContentType);
            var te            = reader.GetTransferEncoding();

            if (te != TransferEncoding.Unknown)
            {
                alternateView.TransferEncoding = te;                                 //fix bug for Content-Type: text/html;
            }
            try { alternateView.ContentId = TrimBrackets(Headers["content-id"] + ""); }
            catch { } //refactor
            AlternateViews.Add(alternateView);
            return(this);
        }
        private MailMimeMessage AddAttachment(MimeReader reader)
        {
            //возможы FormatException для смещения времени по UTC на 0, должно быть исправленно в FW4
            var attachment = new Attachment(new MemoryStream(reader.GetContent(), false), reader.ContentType);
            var te         = reader.GetTransferEncoding();

            if (te != TransferEncoding.Unknown)
            {
                attachment.TransferEncoding = te;                                 //важно установить до установки attachment.ContentDisposition.FileName (а то возможен FormatException )
            }
            if (reader.ContentDisposition != null)
            {
                var cd = reader.ContentDisposition;
                foreach (string key in cd.Parameters.Keys)
                {
                    switch (key)
                    {
                    //PATCH: обход глюка в .NET 4 - происходит падение при следующем сценарии:
                    //var cd = new ContentDisposition();
                    //cd.Parameters.Add("creation-date", "Thu, 09 Oct 2014 09:56:31 +0400");
                    //var cd2 = new ContentDisposition();
                    //cd2.Parameters.Add("creation-date", cd.Parameters["creation-date"]);

                    case "creation-date": attachment.ContentDisposition.CreationDate = cd.CreationDate; break;

                    case "modification-date": attachment.ContentDisposition.ModificationDate = cd.ModificationDate; break;

                    case "read-date": attachment.ContentDisposition.ReadDate = cd.ReadDate; break;

                    default: attachment.ContentDisposition.Parameters.Add(key, cd.Parameters[key]); break;
                    }
                }
            }

            if (!reader.Headers["content-id"].IsEmpty())
            {
                try { attachment.ContentId = TrimBrackets(Headers["content-id"]); }
                catch { } //refactor
            }
            Attachments.Add(attachment);
            return(this);
        }