private static void myTimer_Elapsed(object source, object e) { try { MdiForm.YourTask(); } catch { } }
public static void GoMail() { EmailSendServer emailSendServer = new EmailSendServer() { SenderEmail = Configs.BaseConfig.MailUser, SmtpServer = Configs.BaseConfig.MailSmtp, SmtpServerAccount = Configs.BaseConfig.MailUser, SmtpServerPassword = Configs.BaseConfig.MailPass }; EmailSendServer emailSendServer1 = emailSendServer; int num = (new Random()).Next(0, 99999); string str = SecurityUtil.MD5(num.ToString()).Substring(8, 5); EmailBase emailBase = new EmailBase(); string[] webSiteName = new string[] { Localization.Get("【"), Configs.BaseConfig.WebSiteName, Localization.Get("】即时采集报告("), str, ")" }; emailBase.Subject = string.Concat(webSiteName); emailBase.Content = MdiForm.GetMail(); string[] strArrays = Configs.BaseConfig.MailTitle.Trim().Split(new char[] { ',' }); int num1 = 0; while (true) { if (num1 < (int)strArrays.Length) { string str1 = strArrays[num1]; if (str1 == string.Empty) { break; } else { emailBase.ToEmail = str1; emailSendServer1.SendMail(emailBase); num1++; } } else { break; } } }