internal static MailAddressWrapper GetSerializeableMailAddress(MailAddress ma)
 {
     if (ma == null)
         return null;
     MailAddressWrapper sma = new MailAddressWrapper();
     sma._address = ma.Address;
     sma._displayName = ma.DisplayName;
     return sma;
 }
Example #2
0
        internal static MailAddressWrapper GetSerializeableMailAddress(MailAddress ma)
        {
            if (ma == null)
            {
                return(null);
            }
            MailAddressWrapper sma = new MailAddressWrapper();

            sma._address     = ma.Address;
            sma._displayName = ma.DisplayName;
            return(sma);
        }
Example #3
0
        ///
        /// Creates a new serializeable mailmessage based on a MailMessage object
        ///
        public MailMessageWrapper(MailMessage mm)
        {
            IsBodyHtml = mm.IsBodyHtml;
            Body       = mm.Body;
            Subject    = mm.Subject;
            From       = MailAddressWrapper.GetSerializeableMailAddress(mm.From);
            foreach (MailAddress ma in mm.To)
            {
                To.Add(MailAddressWrapper.GetSerializeableMailAddress(ma));
            }
            foreach (MailAddress ma in mm.CC)
            {
                CC.Add(MailAddressWrapper.GetSerializeableMailAddress(ma));
            }
            foreach (MailAddress ma in mm.Bcc)
            {
                Bcc.Add(MailAddressWrapper.GetSerializeableMailAddress(ma));
            }
            foreach (Attachment att in mm.Attachments)
            {
                Attachments.Add(AttachmentWrapper.GetSerializeableAttachment(att));
            }

            BodyEncoding = mm.BodyEncoding;

            DeliveryNotificationOptions = mm.DeliveryNotificationOptions;
            Headers  = CollectionWrapper.GetSerializeableCollection(mm.Headers);
            Priority = mm.Priority;

            foreach (MailAddress ma in mm.ReplyToList)
            {
                ReplyTo.Add(MailAddressWrapper.GetSerializeableMailAddress(ma));
            }

            Sender          = MailAddressWrapper.GetSerializeableMailAddress(mm.Sender);
            SubjectEncoding = mm.SubjectEncoding;

            foreach (AlternateView av in mm.AlternateViews)
            {
                AlternateViews.Add(AlternateViewWrapper.GetSerializeableAlternateView(av));
            }
        }