Exemple #1
0
        public string connect()
        {
            //Initialize to the pop server.  This code snipped "borrowed"
            //with some modifications...
            //from the article "Retrieve Mail From a POP3 Server Using C#" at
            //www.codeproject.com by Agus Kurniawan
            //http://www.codeproject.com/csharp/popapp.asp

            // create server with port 110
            Server = new TcpClient(pop, m_port);

            try
            {
                // initialization
                NetStrm = Server.GetStream();
                RdStrm  = new StreamReader(Server.GetStream());

                //The pop session is now in the AUTHORIZATION state
                state = connect_state.AUTHORIZATION;
                return(RdStrm.ReadLine());
            }
            catch (InvalidOperationException err)
            {
                return("Error: " + err.ToString());
            }
        }
Exemple #2
0
        public string PASS()
        {
            string temp;

            if (state != connect_state.AUTHORIZATION)
            {
                //the pop command PASS is only valid in the AUTHORIZATION state
                temp = "Connection state not = AUTHORIZATION";
            }
            else
            {
                if (pwd != null)
                {
                    issue_command("PASS " + pwd);
                    temp = read_single_line_response();

                    if (!error)
                    {
                        //transition to the Transaction state
                        state = connect_state.TRANSACTION;
                    }
                }
                else
                {
                    temp = "No Password set.";
                }
            }
            return(temp);
        }
		public string connect()
		{
			//Initialize to the pop server.  This code snipped "borrowed"
			//with some modifications...
			//from the article "Retrieve Mail From a POP3 Server Using C#" at
			//www.codeproject.com by Agus Kurniawan
			//http://www.codeproject.com/csharp/popapp.asp

			// create server with port 110
			Server = new TcpClient(pop,110);								
		
			try
			{
				// initialization
				NetStrm = Server.GetStream();
				RdStrm= new StreamReader(Server.GetStream());

				//The pop session is now in the AUTHORIZATION state
				state=connect_state.AUTHORIZATION ;
				return(RdStrm.ReadLine ());
			}			
			catch(InvalidOperationException err)
			{
				return("Error: "+err.ToString());
			}

		}
Exemple #4
0
        private string disconnect()
        {
            string temp = "disconnected successfully.";

            if (state != connect_state.disc)
            {
                //close connection
                NetStrm.Close();
                RdStrm.Close();
                state = connect_state.disc;
            }
            else
            {
                temp = "Not Connected.";
            }
            return(temp);
        }
		private string disconnect ()
		{
			string temp="disconnected successfully.";
			if(state !=connect_state.disc)
			{

				//close connection
				NetStrm.Close();
				RdStrm.Close();
				state=connect_state.disc ;
			}
			else
			{
				temp="Not Connected.";
			}
			return(temp);
		}
Exemple #6
0
        public string PASS()
        {
            string temp;
            if (state != connect_state.AUTHORIZATION)
            {
                //the pop command PASS is only valid in the AUTHORIZATION state
                temp = "Connection state not = AUTHORIZATION";
            }
            else
            {
                if (pwd != null)
                {
                    issue_command("PASS " + pwd);
                    temp = read_single_line_response();

                    if (!error)
                    {
                        //transition to the Transaction state
                        state = connect_state.TRANSACTION;
                    }
                }
                else
                {
                    temp = "No Password set.";
                }
            }
            return (temp);
        }