Ejemplo n.º 1
0
        public bool ProcessEmbedded(ref RxMailMessage Message)
        {
            //raw email tracing
            if (isGetRawEmail)
            {
                isTraceRawEmail = true;
                if (RawEmailSB == null)
                {
                    RawEmailSB = new StringBuilder(100000);
                }
                else
                {
                    RawEmailSB.Length = 0;
                }
            }

            //convert received email into RxMailMessage
            MimeEntityReturnCode MessageMimeReturnCode = ProcessMimeEntity(Message, "");

            if (isGetRawEmail)
            {
                //add raw email version to message
                Message.RawContent = RawEmailSB.ToString();
                isTraceRawEmail    = false;
            }

            if (MessageMimeReturnCode == MimeEntityReturnCode.bodyComplete || MessageMimeReturnCode == MimeEntityReturnCode.parentBoundaryEndFound)
            {
                TraceFrom("email with {0} body chars received", Message.Body.Length);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets 1 email from POP3 server and processes it.
        /// </summary>
        /// <param name="MessageNo">Email Id to be fetched from POP3 server</param>
        /// <param name="Message">decoded email</param>
        /// <returns>false: no email received or email not properly formatted</returns>
        public bool GetEmail(int MessageNo, out RxMailMessage Message)
        {
            Message = null;

            //request email, send RETRieve command to POP3 server
            if (!SendRetrCommand(MessageNo))
            {
                return(false);
            }

            //prepare message, set defaults as specified in RFC 2046
            //although they get normally overwritten, we have to make sure there are at least defaults
            Message = new RxMailMessage();
            Message.ContentTransferEncoding = TransferEncoding.SevenBit;
            Message.TransferType            = "7bit";
            this.messageNo = MessageNo;

            //raw email tracing
            if (isGetRawEmail)
            {
                isTraceRawEmail = true;
                if (RawEmailSB == null)
                {
                    RawEmailSB = new StringBuilder(100000);
                }
                else
                {
                    RawEmailSB.Length = 0;
                }
            }

            //convert received email into RxMailMessage
            MimeEntityReturnCode MessageMimeReturnCode = ProcessMimeEntity(Message, "");

            if (isGetRawEmail)
            {
                //add raw email version to message
                Message.RawContent = RawEmailSB.ToString();
                isTraceRawEmail    = false;
            }

            if (MessageMimeReturnCode == MimeEntityReturnCode.bodyComplete ||
                MessageMimeReturnCode == MimeEntityReturnCode.parentBoundaryEndFound)
            {
                TraceFrom("email with {0} body chars received", Message.Body.Length);
                return(true);
            }
            return(false);
        }