internal static SerializeableCollection GetSerializeableCollection(StringDictionary col)
        {
            if (col == null)
            {
                return(null);
            }

            SerializeableCollection scol = new SerializeableCollection();

            foreach (String key in col.Keys)
            {
                scol.Collection.Add(key, col[key]);
            }

            return(scol);
        }
        internal static SerializeableContentType GetSerializeableContentType(System.Net.Mime.ContentType ct)
        {
            if (ct == null)
            {
                return(null);
            }

            SerializeableContentType sct = new SerializeableContentType();

            sct.Boundary   = ct.Boundary;
            sct.CharSet    = ct.CharSet;
            sct.MediaType  = ct.MediaType;
            sct.Name       = ct.Name;
            sct.Parameters = SerializeableCollection.GetSerializeableCollection(ct.Parameters);

            return(sct);
        }
        ///

        /// Creates a new serializeable mailmessage based on a MailMessage object
        ///

        ///
        public SerializeableMailMessage(MailMessage mm)
        {
            IsBodyHtml = mm.IsBodyHtml;
            Body       = mm.Body;
            Subject    = mm.Subject;
            From       = SerializeableMailAddress.GetSerializeableMailAddress(mm.From);
            To         = new List <SerializeableMailAddress>();
            foreach (MailAddress ma in mm.To)
            {
                To.Add(SerializeableMailAddress.GetSerializeableMailAddress(ma));
            }

            CC = new List <SerializeableMailAddress>();
            foreach (MailAddress ma in mm.CC)
            {
                CC.Add(SerializeableMailAddress.GetSerializeableMailAddress(ma));
            }

            Bcc = new List <SerializeableMailAddress>();
            foreach (MailAddress ma in mm.Bcc)
            {
                Bcc.Add(SerializeableMailAddress.GetSerializeableMailAddress(ma));
            }

            Attachments = new List <SerializeableAttachment>();
            foreach (Attachment att in mm.Attachments)
            {
                Attachments.Add(SerializeableAttachment.GetSerializeableAttachment(att));
            }

            BodyEncoding = mm.BodyEncoding;

            DeliveryNotificationOptions = mm.DeliveryNotificationOptions;
            Headers         = SerializeableCollection.GetSerializeableCollection(mm.Headers);
            Priority        = mm.Priority;
            ReplyTo         = SerializeableMailAddress.GetSerializeableMailAddress(mm.ReplyTo);
            Sender          = SerializeableMailAddress.GetSerializeableMailAddress(mm.Sender);
            SubjectEncoding = mm.SubjectEncoding;

            foreach (AlternateView av in mm.AlternateViews)
            {
                AlternateViews.Add(SerializeableAlternateView.GetSerializeableAlternateView(av));
            }
        }
        internal static SerializeableContentDisposition GetSerializeableContentDisposition(System.Net.Mime.ContentDisposition cd)
        {
            if (cd == null)
            {
                return(null);
            }

            SerializeableContentDisposition scd = new SerializeableContentDisposition();

            scd.CreationDate     = cd.CreationDate;
            scd.DispositionType  = cd.DispositionType;
            scd.FileName         = cd.FileName;
            scd.Inline           = cd.Inline;
            scd.ModificationDate = cd.ModificationDate;
            scd.Parameters       = SerializeableCollection.GetSerializeableCollection(cd.Parameters);
            scd.ReadDate         = cd.ReadDate;
            scd.Size             = cd.Size;

            return(scd);
        }