Example #1
0
        /// <summary>
        /// Construct a new PopReader pointing to a message header on the server
        /// </summary>
        /// <param name="Id">Message identifier</param>
        /// <returns>A PopReader pointing to the message "num" header</returns>
        /// <exception cref="System.Exception">Raise in case of communication error</exception>
        /// <exception cref="POP3Exception">Raise if the server return an error condition</exception>
        public POPReader GetHeaderReader(POPMessageId Id)
        {
            try
            {
                SendCommand("TOP " + Id.Id + " 0");

                return(new POPReader(m_streamReader, Received, Id.Size));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #2
0
        /// <summary>
        /// Retrieve the message list from the server
        /// </summary>
        /// <returns>The list of message on the server</returns>
        /// <exception cref="System.Exception">Raise in case of communication error</exception>
        /// <exception cref="POP3Exception">Raise if the server return an error condition</exception>
        public POPMessageId[] GetMailList()
        {
            POPMessageId[] Messages;
            string         list = GetList();

            if (list.Length == 0)
            {
                return(null);
            }
            string[] param = list.Split('\n');
            Messages = new POPMessageId[param.Length - 1];

            for (int i = 0; i < param.Length - 1; i++)
            {
                string[] info = param[i].Split(' ');
                if (info.Length > 1)
                {
                    Messages[i] = new POPMessageId(int.Parse(info[0]), int.Parse(info[1]));
                }
            }

            return(Messages);
        }