SmtpPop.cs
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:10k
源码类别:

Email客户端

开发平台:

Visual C++

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using MailManageSystem.RegisterAccount ;
  7. namespace MailManageSystem
  8. {
  9. /// <summary>
  10. /// SmtpPop 的摘要说明。
  11. /// </summary>
  12. public class SmtpPop : System.Windows.Forms.Form
  13. {
  14. private System.Windows.Forms.PictureBox pictureBox1;
  15. private System.Windows.Forms.Label label1;
  16. private System.Windows.Forms.Label label2;
  17. private System.Windows.Forms.Label label3;
  18. private System.Windows.Forms.Label label4;
  19. private System.Windows.Forms.Label label5;
  20. private System.Windows.Forms.TextBox txtPOP3;
  21. private System.Windows.Forms.TextBox txtSMTP;
  22. private System.Windows.Forms.Button btnCancle;
  23. private System.Windows.Forms.Button btnSure;
  24. private System.Windows.Forms.Button btnPre;
  25. private System.Windows.Forms.Label label6;
  26. private System.Windows.Forms.TextBox txtSMTPPort;
  27. private System.Windows.Forms.TextBox txtPOP3Port;
  28. private System.Windows.Forms.Label label7;
  29. /// <summary>
  30. /// 必需的设计器变量。
  31. /// </summary>
  32. private System.ComponentModel.Container components = null;
  33. AccountOperate acOperate=new AccountOperate();
  34. public SmtpPop()
  35. {
  36. InitializeComponent();
  37. }
  38. /// <summary>
  39. /// 清理所有正在使用的资源。
  40. /// </summary>
  41. protected override void Dispose( bool disposing )
  42. {
  43. if( disposing )
  44. {
  45. if(components != null)
  46. {
  47. components.Dispose();
  48. }
  49. }
  50. base.Dispose( disposing );
  51. }
  52. #region Windows 窗体设计器生成的代码
  53. /// <summary>
  54. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  55. /// 此方法的内容。
  56. /// </summary>
  57. private void InitializeComponent()
  58. {
  59. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SmtpPop));
  60. this.pictureBox1 = new System.Windows.Forms.PictureBox();
  61. this.label1 = new System.Windows.Forms.Label();
  62. this.label2 = new System.Windows.Forms.Label();
  63. this.label3 = new System.Windows.Forms.Label();
  64. this.txtPOP3 = new System.Windows.Forms.TextBox();
  65. this.label4 = new System.Windows.Forms.Label();
  66. this.txtSMTP = new System.Windows.Forms.TextBox();
  67. this.label5 = new System.Windows.Forms.Label();
  68. this.btnCancle = new System.Windows.Forms.Button();
  69. this.btnSure = new System.Windows.Forms.Button();
  70. this.btnPre = new System.Windows.Forms.Button();
  71. this.txtSMTPPort = new System.Windows.Forms.TextBox();
  72. this.label6 = new System.Windows.Forms.Label();
  73. this.txtPOP3Port = new System.Windows.Forms.TextBox();
  74. this.label7 = new System.Windows.Forms.Label();
  75. this.SuspendLayout();
  76. // 
  77. // pictureBox1
  78. // 
  79. this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
  80. this.pictureBox1.Location = new System.Drawing.Point(8, 8);
  81. this.pictureBox1.Name = "pictureBox1";
  82. this.pictureBox1.Size = new System.Drawing.Size(136, 296);
  83. this.pictureBox1.TabIndex = 0;
  84. this.pictureBox1.TabStop = false;
  85. // 
  86. // label1
  87. // 
  88. this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
  89. this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
  90. this.label1.Location = new System.Drawing.Point(176, 16);
  91. this.label1.Name = "label1";
  92. this.label1.Size = new System.Drawing.Size(128, 24);
  93. this.label1.TabIndex = 0;
  94. this.label1.Text = "指定邮件服务器";
  95. this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  96. // 
  97. // label2
  98. // 
  99. this.label2.FlatStyle = System.Windows.Forms.FlatStyle.System;
  100. this.label2.Location = new System.Drawing.Point(176, 56);
  101. this.label2.Name = "label2";
  102. this.label2.Size = new System.Drawing.Size(288, 32);
  103. this.label2.TabIndex = 0;
  104. // 
  105. // label3
  106. // 
  107. this.label3.FlatStyle = System.Windows.Forms.FlatStyle.System;
  108. this.label3.Location = new System.Drawing.Point(176, 104);
  109. this.label3.Name = "label3";
  110. this.label3.Size = new System.Drawing.Size(72, 23);
  111. this.label3.TabIndex = 0;
  112. this.label3.Text = "POP3服务器:";
  113. this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
  114. // 
  115. // txtPOP3
  116. // 
  117. this.txtPOP3.Location = new System.Drawing.Point(264, 104);
  118. this.txtPOP3.Name = "txtPOP3";
  119. this.txtPOP3.Size = new System.Drawing.Size(192, 21);
  120. this.txtPOP3.TabIndex = 1;
  121. this.txtPOP3.Text = "";
  122. // 
  123. // label4
  124. // 
  125. this.label4.FlatStyle = System.Windows.Forms.FlatStyle.System;
  126. this.label4.Location = new System.Drawing.Point(176, 168);
  127. this.label4.Name = "label4";
  128. this.label4.Size = new System.Drawing.Size(304, 24);
  129. this.label4.TabIndex = 0;
  130. // 
  131. // txtSMTP
  132. // 
  133. this.txtSMTP.Location = new System.Drawing.Point(264, 208);
  134. this.txtSMTP.Name = "txtSMTP";
  135. this.txtSMTP.Size = new System.Drawing.Size(192, 21);
  136. this.txtSMTP.TabIndex = 3;
  137. this.txtSMTP.Text = "SMTP.163.com";
  138. // 
  139. // label5
  140. // 
  141. this.label5.FlatStyle = System.Windows.Forms.FlatStyle.System;
  142. this.label5.Location = new System.Drawing.Point(176, 208);
  143. this.label5.Name = "label5";
  144. this.label5.Size = new System.Drawing.Size(72, 23);
  145. this.label5.TabIndex = 0;
  146. this.label5.Text = "SMTP服务器:";
  147. this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
  148. // 
  149. // btnCancle
  150. // 
  151. this.btnCancle.FlatStyle = System.Windows.Forms.FlatStyle.System;
  152. this.btnCancle.Location = new System.Drawing.Point(392, 280);
  153. this.btnCancle.Name = "btnCancle";
  154. this.btnCancle.TabIndex = 0;
  155. this.btnCancle.Text = "取消";
  156. this.btnCancle.Click += new System.EventHandler(this.btnCancle_Click);
  157. // 
  158. // btnSure
  159. // 
  160. this.btnSure.FlatStyle = System.Windows.Forms.FlatStyle.System;
  161. this.btnSure.Location = new System.Drawing.Point(280, 280);
  162. this.btnSure.Name = "btnSure";
  163. this.btnSure.TabIndex = 5;
  164. this.btnSure.Text = "完成";
  165. this.btnSure.Click += new System.EventHandler(this.btnSure_Click);
  166. // 
  167. // btnPre
  168. // 
  169. this.btnPre.FlatStyle = System.Windows.Forms.FlatStyle.System;
  170. this.btnPre.Location = new System.Drawing.Point(176, 280);
  171. this.btnPre.Name = "btnPre";
  172. this.btnPre.TabIndex = 0;
  173. this.btnPre.Text = "上一步";
  174. this.btnPre.Click += new System.EventHandler(this.btnPre_Click);
  175. // 
  176. // txtSMTPPort
  177. // 
  178. this.txtSMTPPort.Location = new System.Drawing.Point(264, 232);
  179. this.txtSMTPPort.Name = "txtSMTPPort";
  180. this.txtSMTPPort.Size = new System.Drawing.Size(64, 21);
  181. this.txtSMTPPort.TabIndex = 4;
  182. this.txtSMTPPort.Text = "21";
  183. // 
  184. // label6
  185. // 
  186. this.label6.FlatStyle = System.Windows.Forms.FlatStyle.System;
  187. this.label6.Location = new System.Drawing.Point(200, 232);
  188. this.label6.Name = "label6";
  189. this.label6.Size = new System.Drawing.Size(40, 23);
  190. this.label6.TabIndex = 0;
  191. this.label6.Text = "端口:";
  192. this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  193. // 
  194. // txtPOP3Port
  195. // 
  196. this.txtPOP3Port.Location = new System.Drawing.Point(264, 128);
  197. this.txtPOP3Port.Name = "txtPOP3Port";
  198. this.txtPOP3Port.Size = new System.Drawing.Size(64, 21);
  199. this.txtPOP3Port.TabIndex = 2;
  200. this.txtPOP3Port.Text = "110";
  201. // 
  202. // label7
  203. // 
  204. this.label7.FlatStyle = System.Windows.Forms.FlatStyle.System;
  205. this.label7.Location = new System.Drawing.Point(200, 128);
  206. this.label7.Name = "label7";
  207. this.label7.Size = new System.Drawing.Size(40, 23);
  208. this.label7.TabIndex = 0;
  209. this.label7.Text = "端口:";
  210. this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
  211. // 
  212. // SmtpPop
  213. // 
  214. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  215. this.ClientSize = new System.Drawing.Size(496, 334);
  216. this.Controls.Add(this.txtPOP3Port);
  217. this.Controls.Add(this.label7);
  218. this.Controls.Add(this.txtSMTPPort);
  219. this.Controls.Add(this.label6);
  220. this.Controls.Add(this.btnCancle);
  221. this.Controls.Add(this.btnSure);
  222. this.Controls.Add(this.btnPre);
  223. this.Controls.Add(this.txtSMTP);
  224. this.Controls.Add(this.label5);
  225. this.Controls.Add(this.label4);
  226. this.Controls.Add(this.txtPOP3);
  227. this.Controls.Add(this.label3);
  228. this.Controls.Add(this.label2);
  229. this.Controls.Add(this.label1);
  230. this.Controls.Add(this.pictureBox1);
  231. this.Name = "SmtpPop";
  232. this.Text = "SmtpPop";
  233. this.Closing += new System.ComponentModel.CancelEventHandler(this.SmtpPop_Closing);
  234. this.Load += new System.EventHandler(this.SmtpPop_Load);
  235. this.ResumeLayout(false);
  236. }
  237. #endregion
  238. private void SmtpPop_Load(object sender, System.EventArgs e)
  239. {
  240. this.label2 .Text ="POP3(PostOffice Protocol 3)是用来接受邮件的服务器,您的邮件保存在其上.";
  241. this.label4 .Text ="SMTP(Simple Mail Transfer Protocol)是用来发送邮件的服务器.";
  242. }
  243. private void btnPre_Click(object sender, System.EventArgs e)
  244. {
  245. NewAccount newaccount=new NewAccount ();
  246. newaccount.Show ();
  247. this.Hide ();
  248. }
  249. private void btnCancle_Click(object sender, System.EventArgs e)
  250. {
  251. this.Close ();
  252. }
  253. private void btnSure_Click(object sender, System.EventArgs e)
  254. {
  255. SystemManage.SmtpName =this.txtSMTP .Text ;
  256. SystemManage.SmtpPort =int.Parse (this.txtSMTPPort .Text );
  257. 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+"')");
  258. // SystemManage syManage=new SystemManage ();
  259. // syManage.AddAccount();
  260. SystemManage.flag =true;
  261. this.Close();
  262. }
  263. private void SmtpPop_Closing(object sender, System.ComponentModel.CancelEventArgs e)
  264. {
  265. }
  266. }
  267. }