• 發送Mail(帶Table)



    添加 using System.Web.Mail;

    #region Build html Talbe
       System.Text.StringBuilder tableStr=new StringBuilder();
       tableStr.Append("<TABLE id='Table1' style='Z-INDEX: 102; LEFT: 104px; WIDTH: 700px; POSITION: absolute; TOP: 24px; HEIGHT: 104px' cellSpacing='0' cellPadding='1' width='700' border='1'>");
       tableStr.Append("<TR bgcolor='#99ffff'><TD borderColor='#6600ff' style='HEIGHT: 40px'>ModelName</TD><TD borderColor='#6600ff' style='HEIGHT: 40px'>Customer</TD>");
       tableStr.Append("<TD borderColor='#6600ff' style='HEIGHT: 40px'>周次</TD><TD borderColor='#6600ff' style='HEIGHT: 40px'>Quantity</TD></TR>");
       tableStr.Append("<TR bgcolor='#99ffff'><TD borderColor='#6600ff' style='HEIGHT: 40px'>" + this.Txt_ModelName.Text.Trim().ToUpper() + "</TD>");
       tableStr.Append("<TD borderColor='#6600ff' style='HEIGHT: 40px'>" + this.Txt_Customer.Text.Trim() + "</TD><TD borderColor='#6600ff' style='HEIGHT: 40px'>" + this.Cbox_Week.SelectedValue.ToString() + "</TD>");
       tableStr.Append("<TD borderColor='#6600ff' style='HEIGHT: 40px'>" + this.Txt_Quantity.Text.Trim() + "</TD>");
       tableStr.Append("</TR></TR></TABLE>");
       #endregion

    MailMessage mesg = new MailMessage();
       mesg.From = "web_admini";
       mesg.To=emailaddress;
       mesg.Subject ="業務送樣計劃維護新增";
       mesg.Body = "Dear All:"+"<br>"+"<br>"+"以下列出的是業務送樣計劃維護新增情況:" +"<br>"+ tableStr.ToString() + "<br>"+"<a href=http://inlcnwebap01/NPTR/ target=_blank>http://inlcnwebap01/NPTR/</a>" + "<br>"+
       mesg.BodyFormat=MailFormat.Html;
       SmtpMail.SmtpServer="10.133.130.62";
       SmtpMail.Send(mesg);

  • 相关阅读:
    第二次作业
    自我介绍
    《JavaScript高级程序设计》读书笔记
    三种清理浮动的方式
    简单的水平导航条
    CSS——关于列表和导航条菜单之垂直菜单制作
    css中关于超链接的部分学习心得
    dubbox分布式框架 和相关依赖
    IO操作
    POI动态生成Excel
  • 原文地址:https://www.cnblogs.com/HondaHsu/p/710044.html
Copyright © 2020-2023  润新知