zoukankan      html  css  js  c++  java
  • 發送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);

  • 相关阅读:
    综合练习-词频统计
    组合数据类型综合练习
    Python综合练习
    PostOrder_Traversal 二叉树的非递归后序遍历
    PAT甲级-1152-Google Recruitment(20 分)
    PAT甲级-1007-Maximum Subsequence Sum (25 分)
    macOS MOjave运行pygame不显示图像-解决方案
    PAT甲级-1004-Counting Leaves(30 分)
    Python进阶-Numpy科学计算库(简单入门)
    回文日期
  • 原文地址:https://www.cnblogs.com/HondaHsu/p/710044.html
Copyright © 2011-2022 走看看