POP3 receives data, see http://www.aspalliance.com/chrisg/default.asp?article=93
Change to C # code and modify some bugs such as 1. ASCII, not suitable for domestic mail reading solution: Change to Encoding.Getencoding (936) 2.GetResponse is not a plug-in method, no complete download data resolution Method: Set a Strend flag to determine if the end 3.GetResponse returns a ReceiveBuffersize long data solution each time: according to the received data length, return the corresponding length of the corresponding length in the buffer, etc..
System.Net.Sockets.TcpClient tcpC; System.Net.Sockets.NetworkStream netStream; string SendCommand (string sToSend) {byte [] bData = Encoding.GetEncoding (936) .GetBytes (sToSend Environment.NewLine); netStream.Write ( BDATA, 0, BDATA.LENGTH; RETURN GETRESPONSE ();
String getResponse () {byte [] bdata = new byte [tcpc.receivebuffrsize]; int IREC = NetStream.read (bdata, 0, bdata.length); return encoding.getencoding (936) .getstring (BData, 0, IREC) ;} string readMail (string ps, string un, string pw) {tcpC = new System.Net.Sockets.TcpClient (ps, 110); netStream = tcpC.GetStream (); string strResponse = GetResponse (); string strNL = Environment .Newline; string strand = Strnl "." Strnl " OK" STRNL; Sendcommand ("User"; SendCommand ("pass" pw); strretponse = sendcommand ("stat"); int tent = int32 .PARSE.SPLIT ('') [1]); Response.write (ICOUNT "Messages"); for (int i = 1; i Call method: Readmail (POP3SERVER, Username, Password) PS. Simplified the code, canceled some abnormal capture, to let everyone see clearly.