internal static SerializeableAttachment GetSerializeableAttachment(Attachment att)
        {
            if (att == null)
            {
                return(null);
            }

            SerializeableAttachment saa = new SerializeableAttachment();

            saa.ContentId          = att.ContentId;
            saa.ContentDisposition = SerializeableContentDisposition.GetSerializeableContentDisposition(att.ContentDisposition);

            if (att.ContentStream != null)
            {
                byte[] bytes = new byte[att.ContentStream.Length];
                att.ContentStream.Read(bytes, 0, bytes.Length);

                saa.ContentStream = new MemoryStream(bytes);
            }

            saa.ContentType      = SerializeableContentType.GetSerializeableContentType(att.ContentType);
            saa.Name             = att.Name;
            saa.TransferEncoding = att.TransferEncoding;
            saa.NameEncoding     = att.NameEncoding;
            return(saa);
        }
        ///

        /// 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));
            }
        }