Example #1
0
        public void CompleteAttachment(IAttachmentConstructor att)
        {
            Attachment a = (Attachment)att;

            try
            {
                if (a.IsAttachmentMessageBody)
                {
                    if (a.IsAttachmentMessageBodyHtml)
                    {
                        TextHtml = new MemoryStream(a.ToArray());
                    }
                    else if (a.IsAttachmentMessageBodyTextPlain)
                    {
                        TextPlain = a.Headers.GetEncoding(1251).GetString(a.ToArray()).Trim();
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(a.Headers.MimeContentName))
                    {
                        if (Files == null)
                        {
                            Files = new List <Attachment>();
                        }

                        Files.Add(a);
                    }
                }
            }
            finally
            {
                a.CloseInnerStream();
            }
        }