Hey all,

i need to implement a small c# POP3 Service for one of my customers.

I found some sample code on the net for this, but it does not seem to work! Could anyone try it to see if its just my Company Firewall blocking everything, or if theres something wrong with my code.

Thanks,

Stephan

Code:
public bool connectToServer(string server, string username, string password)
    {
    	private TcpClient myClient;
		private static int port = 110;
        bool result = true;
        
        try
        {
            string message ="";
            myClient = new TcpClient();
            myClient.Connect(server,port);  
            //check if connection is succesfull
            if(getResponse().Substring(0,3) != "+OK")
            {
                result = false;
            }

            //send username to server
            message = "USER " + username + "\r\n";
            writeMessage(message);
            //check if server recognised the username
            if(getResponse().Substring(0,3) != "+OK")
            {
                result = false;
            }
            //send password to server
            message = "PASS " + password + "\r\n";
            writeMessage(message);
            //check if server recognised the password
            if (getResponse().Substring(0,3)!= "+OK")
            {
                result = false;
            }
            return result;
        }
        catch(Exception ex)
        {
            result = false;
            return result;
        }
    }