Example #1
0
 // Создание копии письма
 public MyMailMessage(MyMailMessage message)
 {
     Headers.Add("main", message.Headers.GetValues("main")[0]);
     num    = message.Num;
     id     = message.ID;
     Sender = From = message.From;
     foreach (MailAddress adr in message.To)
     {
         To.Add(adr);
     }
     Subject = message.Subject;
     foreach (MailAddress adr in message.ReplyToList)
     {
         ReplyToList.Add(adr);
     }
     foreach (MailAddress adr in message.CC)
     {
         CC.Add(adr);
     }
     foreach (MailAddress adr in message.Bcc)
     {
         Bcc.Add(adr);
     }
     date                 = message.Date;
     displayDate          = message.DisplayDate;
     mainContentType      = message.mainContentType;
     BodyEncoding         = message.BodyEncoding;
     BodyTransferEncoding = message.BodyTransferEncoding;
     isHaveAttachments    = message.IsHaveAttachments;
     IsBodyHtml           = message.IsBodyHtml;
     myAttachments        = new List <MyAttachment>();
     foreach (MyAttachment att in message.MyAttachments)
     {
         myAttachments.Add(att);
     }
     Body = message.Body;
 }
Example #2
0
        // Создание письма с заголовком
        public MyMailMessage(string header) : base()
        {
            Headers.Add("main", header.Substring(header.IndexOf("\r\n") + 2));
            num    = Convert.ToInt32(ParserMessage.FirstFromTo(header, " ", " "));
            id     = ParserMessage.GetID(header);
            Sender = From = ParserMessage.GetFrom(header);
            MailAddressCollection temp = ParserMessage.GetTo(header);

            foreach (MailAddress adr in temp)
            {
                To.Add(adr);
            }
            Subject = ParserMessage.GetSubject(header);
            temp    = ParserMessage.GetReply(header);
            foreach (MailAddress adr in temp)
            {
                ReplyToList.Add(adr);
            }
            temp = ParserMessage.GetCC(header);
            foreach (MailAddress adr in temp)
            {
                CC.Add(adr);
            }
            temp = ParserMessage.GetBcc(header);
            foreach (MailAddress adr in temp)
            {
                Bcc.Add(adr);
            }
            date                 = ParserMessage.GetDate(header);
            displayDate          = new DateString(date);
            mainContentType      = ParserMessage.GetContentType(header);
            BodyEncoding         = ParserMessage.MyGetEncoding(mainContentType.CharSet);
            BodyTransferEncoding = ParserMessage.GetBodyTransfer(header);
            isHaveAttachments    = (mainContentType.MediaType == "multipart/mixed" || mainContentType.MediaType == "multipart/related");
            IsBodyHtml           = (mainContentType.MediaType == MediaTypeNames.Text.Html);
            myAttachments        = new List <MyAttachment>();
        }