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);

  • 相关阅读:
    模拟打车
    atm转账
    python字符串,列表,字典,集合的常用方法
    while和for的简单使用
    数据库的基本命令
    jmeter监控linux的性能
    jmeter的错误解决Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))
    jmeter的正则参数化
    jmeter的参数化关联
    使用Python解析JSON
  • 原文地址:https://www.cnblogs.com/HondaHsu/p/710044.html
Copyright © 2011-2022 走看看