예제 #1
0
        public SerializableMailMessage(MailMessage mailMessage)
        {
            IsBodyHtml = mailMessage.IsBodyHtml;
            Body       = mailMessage.Body;
            Subject    = mailMessage.Subject;
            From       = new SerializableMailAddress(mailMessage.From);

            foreach (MailAddress ma in mailMessage.To)
            {
                To.Add(new SerializableMailAddress(ma));
            }

            foreach (MailAddress ma in mailMessage.CC)
            {
                CC.Add(new SerializableMailAddress(ma));
            }

            foreach (MailAddress ma in mailMessage.Bcc)
            {
                Bcc.Add(new SerializableMailAddress(ma));
            }

            foreach (Attachment att in mailMessage.Attachments)
            {
                Attachments.Add(new SerializableAttachment(att));
            }

            BodyEncoding = mailMessage.BodyEncoding;

            DeliveryNotificationOptions = mailMessage.DeliveryNotificationOptions;
            Headers  = new SerializableCollection(mailMessage.Headers);
            Priority = mailMessage.Priority;

            foreach (MailAddress ma in mailMessage.ReplyToList)
            {
                ReplyToList.Add(new SerializableMailAddress(ma));
            }

            if (mailMessage.Sender != null)
            {
                Sender = new SerializableMailAddress(mailMessage.Sender);
            }

            SubjectEncoding = mailMessage.SubjectEncoding;

            foreach (AlternateView av in mailMessage.AlternateViews)
            {
                AlternateViews.Add(new SerializableAlternateView(av));
            }
        }
예제 #2
0
        public SerializableMailMessage(MailMessage mailMessage)
        {
            IsBodyHtml = mailMessage.IsBodyHtml;
            Body = mailMessage.Body;
            Subject = mailMessage.Subject;
            From = new SerializableMailAddress(mailMessage.From);

            foreach (MailAddress ma in mailMessage.To)
                To.Add(new SerializableMailAddress(ma));

            foreach (MailAddress ma in mailMessage.CC)
                CC.Add(new SerializableMailAddress(ma));

            foreach (MailAddress ma in mailMessage.Bcc)
                Bcc.Add(new SerializableMailAddress(ma));

            foreach (Attachment att in mailMessage.Attachments)
                Attachments.Add(new SerializableAttachment(att));

            BodyEncoding = mailMessage.BodyEncoding;

            DeliveryNotificationOptions = mailMessage.DeliveryNotificationOptions;
            Headers = new SerializableCollection(mailMessage.Headers);
            Priority = mailMessage.Priority;

            foreach (MailAddress ma in mailMessage.ReplyToList)
                ReplyToList.Add(new SerializableMailAddress(ma));

            if (mailMessage.Sender != null)
                Sender = new SerializableMailAddress(mailMessage.Sender);

            SubjectEncoding = mailMessage.SubjectEncoding;

            foreach (AlternateView av in mailMessage.AlternateViews)
                AlternateViews.Add(new SerializableAlternateView(av));
        }