//间隔检测 private void timerS_Tick(object sender, EventArgs e) { NowCout = int.Parse(pop3.GetNumberOfNewMessages());//获取当前邮件数量 //逻辑思维: 获取当前邮件数量 ,如果当前邮件数量大于从前的邮件数量 将逐个检查邮件的内容 检测到符合标准的邮件则执行方法 if (NowCout > OldCount) { nico.ShowBalloonTip(2000, "Qin亲", "亲,有新邮件,请查收", ToolTipIcon.Info); for (int i = OldCount + 1; i <= NowCout; i++) { pop3.readMailInfo(i); string[] temp = pop3.readMailInfo(i); if ((temp[1] == "<" + FromMail + ">" && temp[3].Trim() == FromTitle) || temp[3].Trim() == FromTitle && txtFromMail.Text == "All") { Console.WriteLine("运行进入"); AppRun(); timerS.Stop(); End(); } } OldCount = NowCout;//更新完成 } }
public void ddg() { POP pop = new POP("pop.126.com", "*****@*****.**", "xujinze", 110); pop.readMailInfo(2); }