Exemplo n.º 1
0
        public bool NextEmail()
        {
            string returned;

            long pos;

            if(m_directPosition == -1)
            {
                if(m_inboxPosition == 0)
                {
                    pos = 1;
                }
                else
                {
                    pos = m_inboxPosition + 1;
                }
            }
            else
            {
                pos = m_directPosition+1;
                m_directPosition = -1;
            }

            // send username ...
            Send("list "+pos.ToString());

            // get response ...
            returned = GetPop3String();

            // if email does not exist at this position
            // then return false ...

            if( returned.Substring(0,4).Equals("-ERR") )
            {
                return false;
            }

            m_inboxPosition = pos;

            // strip out CRLF ...
            string[] noCr = returned.Split(new char[]{ '\r' });

            // get size ...
            string[] elements = noCr[0].Split(new char[]{ ' ' });

            long size = long.Parse(elements[2]);

            // ... else read email data
            m_pop3Message = new Pop3Message(m_inboxPosition,size,m_socket);

            return true;
        }
Exemplo n.º 2
0
        public void CloseConnection()
        {
            Send("quit");

            m_socket = null;
            m_pop3Message = null;
        }