public void ForwardSet(int MailID) { ML_MailBLL mailbll = new ML_MailBLL(MailID); string tmpStr = "<br/>" + mailbll.Model.Content.ToString(); tmpStr = tmpStr.Replace("<br/>", "\r\n"); this.txtSubject.Text = "Fw:" + mailbll.Model.Subject.ToString(); this.ckedit_content.Text = "你好!\n\n\n"; this.ckedit_content.Text += "=======下面是转发邮件=======\n"; this.ckedit_content.Text += "原邮件发件人姓名:" + mailbll.Model.Sender.ToString() + "\n"; this.ckedit_content.Text += "原邮件发送时间:" + mailbll.Model.SendTime.ToString() + "\n"; this.ckedit_content.Text += "原邮件收件人姓名:" + mailbll.Model.ReceiverStr.ToString() + "\n"; this.ckedit_content.Text += tmpStr; //设置附件信息 ML_AttachFileBLL attachfiledal = new ML_AttachFileBLL(); IList<ML_AttachFile> fileList = mailbll.GetAttachFiles(); if (fileList.Count != 0) { for (int i = 0; i < fileList.Count; i++) { ML_AttachFile att = new ML_AttachFile(); att.Size = fileList[i].Size; att.Name = fileList[i].Name; att.Uploaduser = fileList[i].Uploaduser; att.Extname = fileList[i].Extname; att.GUID = fileList[i].GUID; upattlist.Add(att); } } BindAttList(); }
protected void btnUpload_Click(object sender, EventArgs e) { string SavePath = ConfigHelper.GetConfigString("AttachmentPath"); if (string.IsNullOrEmpty(SavePath)) SavePath = "~/Attachment/"; if (!SavePath.EndsWith("/") && !SavePath.EndsWith("\\")) SavePath += "/"; SavePath += "Mail/" + DateTime.Now.ToString("yyyyMMdd") + "/" + (string)Session["UserName"] + "/" + DateTime.Now.ToString("HHmmss"); if (SavePath.StartsWith("~")) { if (!Directory.Exists(Server.MapPath(SavePath))) Directory.CreateDirectory(Server.MapPath(SavePath)); } else { if (!Directory.Exists(SavePath)) Directory.CreateDirectory(SavePath); } ViewState["SavePath"] = SavePath; ArrayList upattlist = (ArrayList)Session["upattlist"]; int size = 0; HtmlInputFile[] hif = { hif1, hif2, hif3, hif4 }; for (int i = 0; i < 4; i++) { string filename = hif[i].PostedFile.FileName.Trim(); if (filename != "") { filename = filename.Substring(filename.LastIndexOf("\\") + 1); ML_AttachFile att = new ML_AttachFile(); // 初始化 att.Name = filename; att.Size = hif[i].PostedFile.ContentLength; att.Uploaduser = (string)Session["UserName"]; att.Extname = filename.Substring(filename.LastIndexOf(".") + 1); att.Visualpath = SavePath + "/" + filename; if (SavePath.StartsWith("~")) hif[i].PostedFile.SaveAs(Server.MapPath(SavePath) + "/" + filename); else hif[i].PostedFile.SaveAs(SavePath + "/" + filename); size += att.Size; upattlist.Add(att); } } Session["upattlist"] = upattlist; if ((size / 1024) == 0) size = 1; else size = size / 1024; ViewState["UploadSize"] = size; BindAttList(); this.SendToRealName = Request.Form["txtSendTo"].ToString(); this.CcToRealName = Request.Form["txtCcTo"].ToString(); this.BccToRealName = Request.Form["txtBccTo"].ToString(); this.SendTo = Request.Form["hdnTxtSendTo"].ToString(); this.CcTo = Request.Form["hdnTxtCcTo"].ToString(); this.BccTo = Request.Form["hdnTxtBccTo"].ToString(); }