Exemple #1
0
        public MailMessage GetMailMessage()
        {
            var mailMessage = new MailMessage
            {
                IsBodyHtml   = IsBodyHtml,
                Body         = Body,
                Subject      = Subject,
                BodyEncoding = BodyEncoding,
                DeliveryNotificationOptions = DeliveryNotificationOptions,
                Priority        = Priority,
                SubjectEncoding = SubjectEncoding,
            };

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

            Headers.CopyTo(mailMessage.Headers);

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

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

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

            return(mailMessage);
        }
Exemple #2
0
        public void CopyTo(ContentDisposition contentDisposition)
        {
            contentDisposition.CreationDate     = CreationDate;
            contentDisposition.DispositionType  = DispositionType;
            contentDisposition.FileName         = FileName;
            contentDisposition.Inline           = Inline;
            contentDisposition.ModificationDate = ModificationDate;
            contentDisposition.ReadDate         = ReadDate;
            contentDisposition.Size             = Size;

            Parameters.CopyTo(contentDisposition.Parameters);
        }
Exemple #3
0
        public ContentType GetContentType()
        {
            var sct = new ContentType()
            {
                Boundary  = Boundary,
                CharSet   = CharSet,
                MediaType = MediaType,
                Name      = Name,
            };

            Parameters.CopyTo(sct.Parameters);

            return(sct);
        }