string url = "http://10.1.1.0/ProcessWeb/Page/ProcessForm.aspx?smdname=AdminSerApplication_SmartDS&formname=AdminSerApplication_Form&procname=AdminSerApplication_Process&step=view&procinstid=" + procinstid; XmlDocument xml = new XmlDocument(); xml.LoadXml(xmlStr); //获取保存路径 string outputFileName = ""; string path = ConfigurationManager.AppSettings["UpLoadFilePath"]; DateTime now = DateTime.Now; string time = now.Year.ToString() + now.Month.ToString() + now.Day.ToString() + now.Hour.ToString() + now.Minute.ToString() + now.Second.ToString() + now.Millisecond.ToString(); string fileName = serialNumber + ".pdf"; string newfileName = path + fileName; //文件保存路径 ////文件名 outputFileName = System.IO.Path.Combine(path, fileName); EO.Pdf.HtmlToPdf.Options.HeaderHtmlFormat = serialNumber; EO.Pdf.HtmlToPdf.Options.FooterHtmlFormat = "流程管理系统"; EO.Pdf.HtmlToPdf.Options.PageSize = EO.Pdf.PdfPageSizes.A5; EO.Pdf.HtmlToPdf.Options.NoLink = false; HtmlToPdf.ConvertUrl(url, outputFileName); PdfDocument doc = new PdfDocument(outputFileName); doc.Security.Disallow(PdfDocumentPermissions.Printing); AcmRender render = new AcmRender(doc); render.BeforeRenderPage += new AcmPageEventHandler(BeforeRenderPage); AcmContent content = new AcmContent(); render.Render(content); doc.Save(outputFileName); MailMessage msg = new MailMessage(); string mailFrom = "11111@qq.com"; string MailAdminPwd = "XXXX"; msg.From = new MailAddress(mailFrom); //发件人的Email地址 string SendMailUser = "123@qq.com"; msg.To.Add(new MailAddress(SendMailUser)); string userName = mailFrom.Substring(0, mailFrom.IndexOf("@")); //取发件人Email用户名 msg.Subject = Title; //邮件标题 msg.Body = Content;//邮件内容 msg.IsBodyHtml = true; //邮件正文格式 msg.Priority = MailPriority.Normal;//优先级别有3个级别 Normal 一般 High 最高 Low 最低 SmtpClient c = new SmtpClient(); //邮件发送类对象 c.Host = "10.1.1.1";//smtp协议地址 c.Port = 25; c.EnableSsl = false; c.UseDefaultCredentials = false; c.Credentials = new NetworkCredential(userName, MailAdminPwd);//自己的用户名及密码 msg.Attachments.Add(new Attachment(outputFileName)); //发送邮件 c.Send(msg); msg.Dispose(); //释放资源 c.Dispose(); //释放资源