Example #1
0
        /// <summary>
        /// Request message list, result is in the form (response, ['mesg_num octets', ...]). If which is set, it is the message to list.
        /// </summary>
        public Pop3MessageInfo List(int MessageID)
        {
            //			CLIENT: LIST 2
            //			SERVER: +ОК 2 200 ...
            //			CLIENT: LIST 3
            //			SERVER: -ERR no such message, only 2 messages in maildrop
            this.SendCommand(string.Format("LIST {0}\r\n", MessageID));

            string listResponse = this.ReadOKResponse();

            string[] NumArray = listResponse.Split(_Delimiter);
            if (NumArray.Length != 2)
            {
                throw new Pop3ServerIncorectAnswerException();
            }

            Pop3MessageInfo message = null;

            try
            {
                message = new Pop3MessageInfo(Int32.Parse(NumArray[0]), null, Int32.Parse(NumArray[1]));
            }
            catch (Exception ex)
            {
                throw new Pop3ServerIncorectAnswerException("Incorect response format.", ex);
            }

            return(message);
        }
Example #2
0
        /// <summary>
        /// Request message list, result is in the form (response, ['mesg_num octets', ...]). If which is set, it is the message to list.
        /// </summary>
        public Pop3MessageInfoList List()
        {
            //			CLIENT: LIST
            //			SERVER: +ОК 2 messages (320 octets)
            //			SERVER: 1 120
            //			SERVER: 2 200
            //			SERVER: . ...
            this.SendCommand("LIST\r\n");
            string statResponse = this.ReadOKResponse();

            Pop3MessageInfoList list = new Pop3MessageInfoList();

            while (true)
            {
                string responseLine = ReadLine();

                if (responseLine.StartsWith("."))
                {
                    break;
                }

                string[] NumArray = responseLine.Split(_Delimiter);
                if (NumArray.Length != 2)
                {
                    throw new Pop3ServerIncorectAnswerException();
                }

                Pop3MessageInfo message = null;

                try
                {
                    message = new Pop3MessageInfo(Int32.Parse(NumArray[0]), null, Int32.Parse(NumArray[1]));
                }
                catch (Exception ex)
                {
                    throw new Pop3ServerIncorectAnswerException("Incorect response format.", ex);
                }

                list.Add(message);
            }

            return(list);
        }
Example #3
0
 /// <summary>
 /// Uidls the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 public void Uidl(Pop3MessageInfo message)
 {
     message.UID = this.Uidl(message.ID).UID;
 }
Example #4
0
        /// <summary>
        /// Request message list, result is in the form (response, ['mesg_num octets', ...]). If which is set, it is the message to list. 
        /// </summary>
        public Pop3MessageInfoList List()
        {
            //			CLIENT: LIST
            //			SERVER: +ОК 2 messages (320 octets)
            //			SERVER: 1 120
            //			SERVER: 2 200
            //			SERVER: . ...
            this.SendCommand("LIST\r\n");
            string statResponse = this.ReadOKResponse();

            Pop3MessageInfoList list = new Pop3MessageInfoList();

            while (true)
            {
                string responseLine = ReadLine();

                if (responseLine.StartsWith("."))
                    break;

                string[] NumArray = responseLine.Split(_Delimiter);
                if (NumArray.Length != 2)
                    throw new Pop3ServerIncorectAnswerException();

                Pop3MessageInfo message = null;

                try
                {
                    message = new Pop3MessageInfo(Int32.Parse(NumArray[0]), null, Int32.Parse(NumArray[1]));
                }
                catch (Exception ex)
                {
                    throw new Pop3ServerIncorectAnswerException("Incorect response format.", ex);
                }

                list.Add(message);
            }

            return list;
        }
Example #5
0
        /// <summary>
        /// Request message list, result is in the form (response, ['mesg_num octets', ...]). If which is set, it is the message to list. 
        /// </summary>
        public Pop3MessageInfo List(int MessageID)
        {
            //			CLIENT: LIST 2
            //			SERVER: +ОК 2 200 ...
            //			CLIENT: LIST 3
            //			SERVER: -ERR no such message, only 2 messages in maildrop
            this.SendCommand(string.Format("LIST {0}\r\n", MessageID));

            string listResponse = this.ReadOKResponse();

            string[] NumArray = listResponse.Split(_Delimiter);
            if (NumArray.Length != 2)
                throw new Pop3ServerIncorectAnswerException();

            Pop3MessageInfo message = null;

            try
            {
                message = new Pop3MessageInfo(Int32.Parse(NumArray[0]), null, Int32.Parse(NumArray[1]));
            }
            catch (Exception ex)
            {
                throw new Pop3ServerIncorectAnswerException("Incorect response format.", ex);
            }

            return message;
        }
Example #6
0
 internal void Add(Pop3MessageInfo message)
 {
     this.List.Add(message);
 }
Example #7
0
 /// <summary>
 /// Uidls the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 public void Uidl(Pop3MessageInfo message)
 {
     message.UID = this.Uidl(message.ID).UID;
 }
Example #8
0
 internal void Add(Pop3MessageInfo message)
 {
     this.List.Add(message);
 }