private EmailInfo InitializeEmailInfo() { EmailInfo Info = new EmailInfo(); Info.AddFiles = FilePath; Info.User = Common.Common.MailAddress; Info.PassWord = Common.Common.MailPassword; Info.Content = ""; Info.Title = DateTime.Now.ToLongTimeString() + "听课反馈"; Info.Receiver = help.getDs("select * from Teachers_Data where Teacher like '%" + Listview.CheckedItems[0].SubItems[6].Text + "%'", "Teachers_Data").Tables[0].Rows[0][2].ToString(); return Info; }
public void SentPlacement() { WordTableInfo Info = InitializeWordInfo();//对象初始化 WordTools Tool = new WordTools(); List<string> ListSupervisor = new List<string>();//存放督导成员 List<string> ListFileName = new List<string>(); EmailInfo EInfo = new EmailInfo(); SqlHelper help = new SqlHelper(); List<string> ListAddress = new List<string>(); DistinctSupervisor(Info.Supervisor, ListSupervisor);//分解出每个督导员 FillWordTable(ListSupervisor,Info,Tool,ListFileName);//填写相应的word表格 FindEmailAddress(ListSupervisor,help,ListAddress);//找到每个人的邮箱地址 MakeEmail(EInfo,ListFileName,ListAddress,help,ListSupervisor);//发邮件 }
private ResultCallBack resultcallback; //实例化回调方法 #endregion Fields #region Constructors /// <summary> /// 构造函数 /// </summary> /// <param name="info">邮件信息</param> /// <param name="reinfo">邮件记录</param> /// <param name="resultcallback">回调函数</param> public AsynEmail(EmailInfo info,EmailRecordInfo reinfo,ResultCallBack resultcallback) { this.Info = info; this.resultcallback = resultcallback; this.ReInfo = reinfo; }
private EmailInfo InitializeEmailInfo() { EmailInfo EInfo = new EmailInfo(); EInfo.User = Common.MailAddress; EInfo.PassWord = Common.MailPassword; EInfo.Title = listView1.CheckedItems[0].SubItems[3].Text; EInfo.Content = ""; EInfo.AddFiles = help.getDs("select * from Logs_Data where Time_Now='" + listView1.CheckedItems[0].SubItems[4].Text + "'", "Logs_Data").Tables[0].Rows[0][6].ToString(); EInfo.Receiver = help.getDs("select * from Teachers_Data where Teacher like '%" + listView1.CheckedItems[0].SubItems[1].Text + "%'", "Teachers_Data").Tables[0].Rows[0][2].ToString(); return EInfo; }
private void MakeEmail(EmailInfo EInfo,List<string> ListFileName,List<string> ListAddress,SqlHelper help,List<string> ListSupervisor) { if (Common.Common.MailPassword !="") { EInfo.User = Common.Common.MailAddress; EInfo.PassWord = Common.Common.MailPassword; EmailRecordInfo ERecord; sentnum = ListFileName.Count; for (int i = 0; i < ListFileName.Count; i++) { EInfo.AddFiles = ListFileName[i]; EInfo.Content = ""; EInfo.Receiver = ListAddress[i]; EInfo.Title = DateTime.Now + "听课安排"; string successflag = ""; ERecord = new EmailRecordInfo(ListSupervisor[i], "督导", EInfo.Title, ListSupervisor[i] + DateTime.Now.ToLongTimeString() + i, "听课安排", successflag, ListFileName[i]); AsynEmail EmailSendPoccess = new AsynEmail(EInfo, ERecord, this.EmailResultCallBack); EmailSendPoccess.ThreadSend(); //MessageBox.Show(successflag); //help.Insert(ERecord,"Logs_Data"); Main.fm.SetStatusText("正在发送邮件", 0); } } else MessageBox.Show("发件人邮箱不能为空,请设置发件人邮箱!"); }
private void MakeEmail(EmailInfo EInfo,List<string> ListFileName,List<string> ListAddress,Email senter,SqlHelper help,List<string> ListSupervisor) { EInfo.User = Common.Common.MailAddress; EInfo.PassWord = Common.Common.MailPassword; EmailRecordInfo ERecord; for (int i = 0; i < ListFileName.Count; i++) { EInfo.AddFiles = ListFileName[i]; EInfo.Content = ""; EInfo.Receiver = ListAddress[i]; EInfo.Title = DateTime.Now + "听课安排"; string successflag=""; ERecord = new EmailRecordInfo(ListSupervisor[i], "督导", EInfo.Title, ListSupervisor[i] + DateTime.Now.ToLongTimeString()+i, "听课安排", successflag, ListFileName[i]); senter.Send(new Email {Type=0,EI= EInfo,ERI=ERecord,list=listView1,id=i,count=ListFileName.Count-1}); //MessageBox.Show(successflag); //help.Insert(ERecord,"Logs_Data"); } }