Ejemplo n.º 1
0
        ///
        /// Returns the MailMessge object from the serializeable object
        ///
        ///
        public MailMessage GetMailMessage()
        {
            var mailMessage = new MailMessage();

            mailMessage.IsBodyHtml = IsBodyHtml;
            mailMessage.Body       = Body;
            mailMessage.Subject    = Subject;
            if (From != null)
            {
                mailMessage.From = From.GetMailAddress();
            }

            foreach (var mailAddress in _to)
            {
                mailMessage.To.Add(mailAddress.GetMailAddress());
            }

            foreach (var mailAddress in _cc)
            {
                mailMessage.CC.Add(mailAddress.GetMailAddress());
            }

            foreach (var mailAddress in _bcc)
            {
                mailMessage.Bcc.Add(mailAddress.GetMailAddress());
            }

            foreach (var attachment in _attachments)
            {
                mailMessage.Attachments.Add(attachment.GetAttachment());
            }

            mailMessage.BodyEncoding = _bodyEncoding;

            mailMessage.DeliveryNotificationOptions = _deliveryNotificationOptions;
            _headers.SetColletion(mailMessage.Headers);
            mailMessage.Priority = _priority;
            if (ReplyTo != null)
            {
                foreach (SerializeableMailAddress address in ReplyTo)
                {
                    mailMessage.ReplyToList.Add(address.GetMailAddress());
                }
            }

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

            mailMessage.SubjectEncoding = _subjectEncoding;

            foreach (var alternateView in _alternateViews)
            {
                mailMessage.AlternateViews.Add(alternateView.GetAlternateView());
            }

            return(mailMessage);
        }
        internal void SetContentDisposition(ContentDisposition scd)
        {
            scd.CreationDate     = CreationDate;
            scd.DispositionType  = DispositionType;
            scd.FileName         = FileName;
            scd.Inline           = Inline;
            scd.ModificationDate = ModificationDate;
            Parameters.SetColletion(scd.Parameters);

            scd.ReadDate = ReadDate;
            scd.Size     = Size;
        }
Ejemplo n.º 3
0
        internal ContentType GetContentType()
        {
            var sct = new ContentType();

            sct.Boundary  = _boundary;
            sct.CharSet   = _charSet;
            sct.MediaType = _mediaType;
            sct.Name      = _name;

            _parameters.SetColletion(sct.Parameters);

            return(sct);
        }