private void MainForm_Load(object sender, EventArgs e) { this.BackColor = Color.FromArgb(63, 176, 215); LoadingIndex.Show(); TimerLoad.Enabled = true; TimerLoad.Interval = 4000; TimerClock.Enabled = true; TimerClock.Interval = 1000; LblVersion.Text = LblVersion.Text + Assembly.GetExecutingAssembly().GetName().Version.ToString(); CmoBoxPrior.SelectedIndex = 1; FindPwd.Left = (this.Width - FindPwd.Width) / 2;//还原位置 FindPwd.Visible = false; Tool.StationNameXml(); LblShowEmail.Text = "邮箱:" + u.Email; LblShowTel.Text = "电话:" + u.Tel; LblUserNameShow.Text = "用户名:" + u.UserName; LblShowDep.Text = "所在单位:" + u.School; LoadingEmail.Hide(); LoadingNews.Hide(); LoadingTicket.Hide(); }
private void BtnSendMail_Click(object sender, EventArgs e) { if (CmoBoxMailHost.Text == string.Empty) { MessageBoxEx.Show("主机地址不能为空!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (CmoBoxPrior.Text == string.Empty) { MessageBoxEx.Show("优先级不能为空!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (TextBoxMailFrom.Text == string.Empty) { MessageBoxEx.Show("发件人不能为空!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (TextBoxPwd.Text == string.Empty) { MessageBoxEx.Show("密码不能为空!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (TextBoxMailTo.Text == string.Empty) { MessageBoxEx.Show("收件人不能为空!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } LoadingEmail.Show(); Send.SendMail send = new Send.SendMail(TextBoxMailFrom.Text, TextBoxPwd.Text, TextBoxMailFromName.Text, CmoBoxMailHost.Text, Convert.ToInt32(NumUpDownPort.Value)); int n = send.send(TextBoxMailTo.Text, EmailSubject.Text, RichTextBoxBodey.Text, CmoBoxPrior.Text); if (n != 0) { MessageBoxEx.Show("成功发送" + n + "封邮件", "完成", MessageBoxButtons.OK, MessageBoxIcon.None); } LoadingEmail.Hide(); }