예제 #1
0
        protected virtual void Parse()
        {
            int             unparsed    = 0;
            DataParseStatus parseStatus = DataParseStatus.Invalid;

            try
            {
                // Step 1. Parse header [1/23/2004]
                parseStatus = _headers.ParseHeaders(_EMailBinaryData.GetBuffer(), (int)_EMailBinaryData.Length, ref unparsed);
                if (parseStatus == DataParseStatus.Done)
                {
                    // Step 2. Parse Messagy Body [1/23/2004]
                    parseStatus = _mimeEntries.ParseMimeEntries(_EMailBinaryData.GetBuffer(), (int)_EMailBinaryData.Length, ref unparsed, this.Headers);
                }
            }
            catch (Exception ex)
            {
                throw new Pop3ServerIncorectEMailFormatException("Internal Parser Error", ex);
            }

            if (parseStatus != DataParseStatus.Done)
            {
                throw new Pop3ServerIncorectEMailFormatException();
            }
        }
예제 #2
0
        protected virtual void ParseHeaderAndBody()
        {
            DataParseStatus parseStatus = DataParseStatus.Invalid;

            try
            {
                // Step 1. Parse header [1/23/2004]
                parseStatus = _headers.ParseHeaders(_BinaryData.GetBuffer(), (int)_BinaryData.Length, ref _BodyOffset);
                if (parseStatus == DataParseStatus.Done)
                {
                    ParseBody();
                }
            }
            catch (Exception ex)
            {
                throw new Pop3ServerIncorectEMailFormatException("Internal Parser Error: " + ex.Message, ex);
            }

            if (parseStatus != DataParseStatus.Done)
            {
                throw new Pop3ServerIncorectEMailFormatException();
            }
        }