Exemple #1
0
        /* Assume (for now) the message starts with the postmark,
         * Further assume the message structure
         * postmark\r\n
         * headers\r\n
         * \r\n
         * body
         */
        public async Task <ParseResult> Parse(MessageReader reader)
        {
            postmark = new Postmark(entity);
            if ((await postmark.Parse(reader)) == ParseResult.Failed)
            {
                throw new ParsingFailedException("postmark is not found");
            }
            email = new Email(entity);
            ParseResult res = await email.Parse(reader);

            if (res != ParseResult.Eof && res != ParseResult.Postmark)
            {
                await ConsumeToEnd(reader);
            }
            SetSize();

            return(res);
        }
Exemple #2
0
        /* Assume (for now) the message starts with the postmark,
           Further assume the message structure
           postmark\r\n
           headers\r\n
           \r\n
           body
        */
        public async Task<ParseResult> Parse(MessageReader reader)
        {
            postmark = new Postmark(entity);
            if ((await postmark.Parse(reader)) == ParseResult.Failed)
                throw new ParsingFailedException("postmark is not found");
            email = new Email(entity);
            ParseResult res = await email.Parse(reader);
            if (res != ParseResult.Eof && res != ParseResult.Postmark)
                await ConsumeToEnd(reader);
            SetSize();

            return res;
        }