Exemplo n.º 1
0
		internal bool NextEmail()
		{
		    long pos;

			if(_directPosition == -1)
			{
				if(_inboxPosition == 0)
				{
					pos = 1;
				}
				else
				{
					pos = _inboxPosition + 1;
				}
			}
			else
			{
				pos = _directPosition+1;
				_directPosition = -1;
			}

			// send username ...
			Send("list "+pos);
		
			// get response ...
			var returned = GetPop3String();

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

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

			_inboxPosition = pos;

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

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

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

			// ... else read email data
			_pop3Message = new Pop3Message(_inboxPosition,size,_socket);

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

			_socket = null;
			_pop3Message = null;
		}