static void Main() { if (Glo.IsExitProcess("CCFlowServices.exe")) { MessageBox.Show("驰骋工作流程设计器应用程序已经启动,您不能同时启动两个操作窗口。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Exit(); } Glo.LoadConfigByFile(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Emp emp = new Emp("zhanghaicheng"); //BP.Web.WebUser.SignInOfGener(emp); //WorkNode wn = new WorkNode(499, 1301); //wn.AfterNodeSave(); Application.Run(new FrmMain()); }
/// <summary> /// 发送邮件。 /// </summary> /// <param name="sms"></param> public void SendMail(BP.Sys.SMS sms) { //如果向 ccim 写入消息。 if (this.CB_IsWriteToCCIM.Checked) { try { Glo.SendMessage(sms.MyPK, DateTime.Now.ToString(), sms.Title + "\t\n" + sms.Doc, sms.MsgAccepter); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误"); return; } } if (string.IsNullOrEmpty(sms.MsgAccepter)) { BP.WF.Port.WFEmp emp = new BP.WF.Port.WFEmp(sms.SendToEmpID); if (sms.MsgType == 0) { sms.MsgAccepter = emp.Email; } else { sms.MsgAccepter = emp.Tel; } } System.Net.Mail.MailMessage myEmail = new System.Net.Mail.MailMessage(); myEmail.From = new MailAddress("*****@*****.**", "ccflow", System.Text.Encoding.UTF8); myEmail.To.Add(sms.MsgAccepter); myEmail.Subject = sms.Title; myEmail.SubjectEncoding = System.Text.Encoding.UTF8;//邮件标题编码 myEmail.Body = sms.Doc; myEmail.BodyEncoding = System.Text.Encoding.UTF8; //邮件内容编码 myEmail.IsBodyHtml = true; //是否是HTML邮件 myEmail.Priority = MailPriority.High; //邮件优先级 SmtpClient client = new SmtpClient(); client.Credentials = new System.Net.NetworkCredential(SystemConfig.GetValByKey("SendEmailAddress", "*****@*****.**"), SystemConfig.GetValByKey("SendEmailPass", "ccflow123")); //上述写你的邮箱和密码 client.Port = SystemConfig.GetValByKeyInt("SendEmailPort", 587); //使用的端口 client.Host = SystemConfig.GetValByKey("SendEmailHost", "smtp.gmail.com"); client.EnableSsl = SystemConfig.GetValByKeyBoolen("SendEmailEnableSsl", true); object userState = myEmail; try { client.SendAsync(myEmail, userState); sms.HisMsgSta = BP.Sys.MsgSta.RunOK; sms.Update(); } catch (System.Net.Mail.SmtpException ex) { throw ex; } }