C# Builder 实现POP3信箱的监视__教程 |
|
日期:2007-5-20 1:21:23 人气:178 [大 中 小] |
|
|
|
// // label5 // this.label5.Location = new System.Drawing.Point(264, 129); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(40, 16); this.label5.TabIndex = 11; this.label5.Text = "毫秒"; // // button3 // this.button3.Location = new System.Drawing.Point(264, 176); this.button3.Name = "button3"; this.button3.TabIndex = 12; this.button3.Text = "应用"; this.button3.Click += new System.EventHandler(this.button3_Click); // // cB_autorun // this.cB_autorun.Location = new System.Drawing.Point(112, 152); this.cB_autorun.Name = "cB_autorun"; this.cB_autorun.Size = new System.Drawing.Size(160, 24); this.cB_autorun.TabIndex = 13; this.cB_autorun.Text = "启动时自动执行"; // // WinForm // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(368, 301); this.Controls.Add(this.cB_autorun); this.Controls.Add(this.button3); this.Controls.Add(this.label5); this.Controls.Add(this.tB_mins); this.Controls.Add(this.label4); this.Controls.Add(this.button2); this.Controls.Add(this.tB_status); this.Controls.Add(this.tB_pwd); this.Controls.Add(this.tB_user); this.Controls.Add(this.tB_server); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.button1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "WinForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "收取邮件"; this.Load += new System.EventHandler(this.WinForm_Load); this.Activated += new System.EventHandler(this.WinForm_Activated); this.ResumeLayout(false); } #endregion
/// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new WinForm()); }
private void button1_Click(object sender, System.EventArgs e) { string str_server; if ((tB_server.Text!="") && (tB_user.Text!="") && (tB_pwd.Text!="")) { TcpClient tcpc = new TcpClient(tB_server.Text,110); Byte[] outbytes; string input; NetworkStream ns = null; try{ ns = tcpc.GetStream(); StreamReader sr = new StreamReader(ns); tB_status.Text=sr.ReadLine();
input = "USER " + tB_user.Text + "\r\n"; outbytes = System.Text.Encoding.ASCII.GetBytes(input.ToCharArray()); ns.Write(outbytes,0,outbytes.Length) tB_status.Text=tB_status.Text+"\r\n"+sr.ReadLine();
input = "PASS " + tB_pwd.Text + "\r\n"; outbytes = System.Text.Encoding.ASCII.GetBytes(input.ToCharArray()); ns.Write(outbytes,0,outbytes.Length) tB_status.Text=tB_status.Text+"\r\n"+sr.ReadLine();
input = "STAT" + "\r\n"; outbytes = System.Text.Encoding.ASCII.GetBytes(input.ToCharArray()); |
|
出处:本站原创 作者:佚名 |
|
|