www.pudn.com > C++biyesheji.rar > SmtpPop.cs


using System; 
using System.Drawing; 
using System.Collections; 
using System.ComponentModel; 
using System.Windows.Forms; 
using MailManageSystem.RegisterAccount ; 
namespace MailManageSystem 
{ 
	///  
	/// SmtpPop 的摘要说明。 
	///  
	public class SmtpPop : System.Windows.Forms.Form 
	{ 
		private System.Windows.Forms.PictureBox pictureBox1; 
		private System.Windows.Forms.Label label1; 
		private System.Windows.Forms.Label label2; 
		private System.Windows.Forms.Label label3; 
		private System.Windows.Forms.Label label4; 
		private System.Windows.Forms.Label label5; 
		private System.Windows.Forms.TextBox txtPOP3; 
		private System.Windows.Forms.TextBox txtSMTP; 
		private System.Windows.Forms.Button btnCancle; 
		private System.Windows.Forms.Button btnSure; 
		private System.Windows.Forms.Button btnPre; 
		private System.Windows.Forms.Label label6; 
		private System.Windows.Forms.TextBox txtSMTPPort; 
		private System.Windows.Forms.TextBox txtPOP3Port; 
		private System.Windows.Forms.Label label7; 
		///  
		/// 必需的设计器变量。 
		///  
		private System.ComponentModel.Container components = null; 
		AccountOperate acOperate=new AccountOperate(); 
	 
		public SmtpPop() 
		{ 
			InitializeComponent(); 
		} 
 
		 
		///  
		/// 清理所有正在使用的资源。 
		///  
		protected override void Dispose( bool disposing ) 
		{ 
			if( disposing ) 
			{ 
				if(components != null) 
				{ 
					components.Dispose(); 
				} 
			} 
			base.Dispose( disposing ); 
		} 
 
		#region Windows 窗体设计器生成的代码 
		///  
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改 
		/// 此方法的内容。 
		///  
		private void InitializeComponent() 
		{ 
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SmtpPop)); 
			this.pictureBox1 = new System.Windows.Forms.PictureBox(); 
			this.label1 = new System.Windows.Forms.Label(); 
			this.label2 = new System.Windows.Forms.Label(); 
			this.label3 = new System.Windows.Forms.Label(); 
			this.txtPOP3 = new System.Windows.Forms.TextBox(); 
			this.label4 = new System.Windows.Forms.Label(); 
			this.txtSMTP = new System.Windows.Forms.TextBox(); 
			this.label5 = new System.Windows.Forms.Label(); 
			this.btnCancle = new System.Windows.Forms.Button(); 
			this.btnSure = new System.Windows.Forms.Button(); 
			this.btnPre = new System.Windows.Forms.Button(); 
			this.txtSMTPPort = new System.Windows.Forms.TextBox(); 
			this.label6 = new System.Windows.Forms.Label(); 
			this.txtPOP3Port = new System.Windows.Forms.TextBox(); 
			this.label7 = new System.Windows.Forms.Label(); 
			this.SuspendLayout(); 
			//  
			// pictureBox1 
			//  
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); 
			this.pictureBox1.Location = new System.Drawing.Point(8, 8); 
			this.pictureBox1.Name = "pictureBox1"; 
			this.pictureBox1.Size = new System.Drawing.Size(136, 296); 
			this.pictureBox1.TabIndex = 0; 
			this.pictureBox1.TabStop = false; 
			//  
			// label1 
			//  
			this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); 
			this.label1.Location = new System.Drawing.Point(176, 16); 
			this.label1.Name = "label1"; 
			this.label1.Size = new System.Drawing.Size(128, 24); 
			this.label1.TabIndex = 0; 
			this.label1.Text = "指定邮件服务器"; 
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 
			//  
			// label2 
			//  
			this.label2.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.label2.Location = new System.Drawing.Point(176, 56); 
			this.label2.Name = "label2"; 
			this.label2.Size = new System.Drawing.Size(288, 32); 
			this.label2.TabIndex = 0; 
			//  
			// label3 
			//  
			this.label3.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.label3.Location = new System.Drawing.Point(176, 104); 
			this.label3.Name = "label3"; 
			this.label3.Size = new System.Drawing.Size(72, 23); 
			this.label3.TabIndex = 0; 
			this.label3.Text = "POP3服务器:"; 
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 
			//  
			// txtPOP3 
			//  
			this.txtPOP3.Location = new System.Drawing.Point(264, 104); 
			this.txtPOP3.Name = "txtPOP3"; 
			this.txtPOP3.Size = new System.Drawing.Size(192, 21); 
			this.txtPOP3.TabIndex = 1; 
			this.txtPOP3.Text = ""; 
			//  
			// label4 
			//  
			this.label4.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.label4.Location = new System.Drawing.Point(176, 168); 
			this.label4.Name = "label4"; 
			this.label4.Size = new System.Drawing.Size(304, 24); 
			this.label4.TabIndex = 0; 
			//  
			// txtSMTP 
			//  
			this.txtSMTP.Location = new System.Drawing.Point(264, 208); 
			this.txtSMTP.Name = "txtSMTP"; 
			this.txtSMTP.Size = new System.Drawing.Size(192, 21); 
			this.txtSMTP.TabIndex = 3; 
			this.txtSMTP.Text = "SMTP.163.com"; 
			//  
			// label5 
			//  
			this.label5.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.label5.Location = new System.Drawing.Point(176, 208); 
			this.label5.Name = "label5"; 
			this.label5.Size = new System.Drawing.Size(72, 23); 
			this.label5.TabIndex = 0; 
			this.label5.Text = "SMTP服务器:"; 
			this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 
			//  
			// btnCancle 
			//  
			this.btnCancle.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.btnCancle.Location = new System.Drawing.Point(392, 280); 
			this.btnCancle.Name = "btnCancle"; 
			this.btnCancle.TabIndex = 0; 
			this.btnCancle.Text = "取消"; 
			this.btnCancle.Click += new System.EventHandler(this.btnCancle_Click); 
			//  
			// btnSure 
			//  
			this.btnSure.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.btnSure.Location = new System.Drawing.Point(280, 280); 
			this.btnSure.Name = "btnSure"; 
			this.btnSure.TabIndex = 5; 
			this.btnSure.Text = "完成"; 
			this.btnSure.Click += new System.EventHandler(this.btnSure_Click); 
			//  
			// btnPre 
			//  
			this.btnPre.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.btnPre.Location = new System.Drawing.Point(176, 280); 
			this.btnPre.Name = "btnPre"; 
			this.btnPre.TabIndex = 0; 
			this.btnPre.Text = "上一步"; 
			this.btnPre.Click += new System.EventHandler(this.btnPre_Click); 
			//  
			// txtSMTPPort 
			//  
			this.txtSMTPPort.Location = new System.Drawing.Point(264, 232); 
			this.txtSMTPPort.Name = "txtSMTPPort"; 
			this.txtSMTPPort.Size = new System.Drawing.Size(64, 21); 
			this.txtSMTPPort.TabIndex = 4; 
			this.txtSMTPPort.Text = "21"; 
			//  
			// label6 
			//  
			this.label6.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.label6.Location = new System.Drawing.Point(200, 232); 
			this.label6.Name = "label6"; 
			this.label6.Size = new System.Drawing.Size(40, 23); 
			this.label6.TabIndex = 0; 
			this.label6.Text = "端口:"; 
			this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 
			//  
			// txtPOP3Port 
			//  
			this.txtPOP3Port.Location = new System.Drawing.Point(264, 128); 
			this.txtPOP3Port.Name = "txtPOP3Port"; 
			this.txtPOP3Port.Size = new System.Drawing.Size(64, 21); 
			this.txtPOP3Port.TabIndex = 2; 
			this.txtPOP3Port.Text = "110"; 
			//  
			// label7 
			//  
			this.label7.FlatStyle = System.Windows.Forms.FlatStyle.System; 
			this.label7.Location = new System.Drawing.Point(200, 128); 
			this.label7.Name = "label7"; 
			this.label7.Size = new System.Drawing.Size(40, 23); 
			this.label7.TabIndex = 0; 
			this.label7.Text = "端口:"; 
			this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 
			//  
			// SmtpPop 
			//  
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); 
			this.ClientSize = new System.Drawing.Size(496, 334); 
			this.Controls.Add(this.txtPOP3Port); 
			this.Controls.Add(this.label7); 
			this.Controls.Add(this.txtSMTPPort); 
			this.Controls.Add(this.label6); 
			this.Controls.Add(this.btnCancle); 
			this.Controls.Add(this.btnSure); 
			this.Controls.Add(this.btnPre); 
			this.Controls.Add(this.txtSMTP); 
			this.Controls.Add(this.label5); 
			this.Controls.Add(this.label4); 
			this.Controls.Add(this.txtPOP3); 
			this.Controls.Add(this.label3); 
			this.Controls.Add(this.label2); 
			this.Controls.Add(this.label1); 
			this.Controls.Add(this.pictureBox1); 
			this.Name = "SmtpPop"; 
			this.Text = "SmtpPop"; 
			this.Closing += new System.ComponentModel.CancelEventHandler(this.SmtpPop_Closing); 
			this.Load += new System.EventHandler(this.SmtpPop_Load); 
			this.ResumeLayout(false); 
 
		} 
		#endregion 
 
		private void SmtpPop_Load(object sender, System.EventArgs e) 
		{ 
			this.label2 .Text ="POP3(PostOffice Protocol 3)是用来接受邮件的服务器,您的邮件保存在其上."; 
			this.label4 .Text ="SMTP(Simple Mail Transfer Protocol)是用来发送邮件的服务器."; 
		} 
 
		private void btnPre_Click(object sender, System.EventArgs e) 
		{ 
			NewAccount newaccount=new NewAccount (); 
			newaccount.Show (); 
			this.Hide (); 
		} 
 
		private void btnCancle_Click(object sender, System.EventArgs e) 
		{ 
			this.Close (); 
		} 
 
		private void btnSure_Click(object sender, System.EventArgs e) 
		{ 
			SystemManage.SmtpName =this.txtSMTP .Text ; 
			SystemManage.SmtpPort =int.Parse (this.txtSMTPPort .Text ); 
			acOperate.AddDelAccount("insert into users(AccountName,userName,PassW,MailAddress,smtp,Port) values('"+SystemManage.AccountName  +"','"+SystemManage.UserName+"','"+SystemManage.PassWd+"','"+SystemManage.MailAddress+"','"+this.txtSMTP .Text +"','"+this.txtSMTPPort .Text+"')"); 
//			SystemManage syManage=new SystemManage (); 
//			syManage.AddAccount(); 
			SystemManage.flag =true; 
			this.Close(); 
 
				 
		} 
 
		private void SmtpPop_Closing(object sender, System.ComponentModel.CancelEventArgs e) 
		{ 
			 
		} 
	} 
}