• 發送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);

  • 相关阅读:
    从开心网的奴隶安抚与折磨想到员工积极性与人力成本的问题
    悲剧的做网站的,我们都没有认真的前行
    如何做生意
    Android Market中产品图标设计原则
    控制UpdataPanel中的GridView模板列控件同步刷新
    DataTable筛选
    IE6,7,8,FF兼容总结
    DevPress Grid 设置行样式
    SQL分组查询
    DevexPress checkedit 多选解决方案(原创)
  • 原文地址:https://www.cnblogs.com/HondaHsu/p/710044.html
Copyright © 2020-2023  润新知