Esempio n. 1
0
        public IAttachmentConstructor GetAttachmentConstructor(HeaderCollection headers)
        {
            AttachmentFormat format       = headers.GetAttachmentFormat();
            bool             requiredBody = false;
            Stream           stream       = null;

            if (format == AttachmentFormat.Html)
            {
                requiredBody = true;
                stream       = new MemoryStream();
            }
            else if (format == AttachmentFormat.PlainText)
            {
                requiredBody = true;
                stream       = new MemoryStream();
            }

            Attachment att = new Attachment(
                headers,
                stream,
                new DecoderSelector(),
                requiredBody,
                (err, comm) => ErrorHandler(err, comm));

            return(att);
        }
Esempio n. 2
0
        public IAttachmentConstructor GetAttachmentConstructor(HeaderCollection headers)
        {
            AttachmentFormat format = headers.GetAttachmentFormat();
            bool requiredBody = false;
            Stream stream = null;

            if (format == AttachmentFormat.Html)
            {
                requiredBody = true;
                stream = new MemoryStream();
            }
            else if (format == AttachmentFormat.PlainText)
            {
                requiredBody = true;
                stream = new MemoryStream();
            }

            Attachment att = new Attachment(
                headers, 
                stream,
                new DecoderSelector(), 
                requiredBody, 
                (err, comm) => ErrorHandler(err, comm));

            return att;
        }