发是可以发的 就是邮件里内容需要用表格圈起来
不知道什么圈 怎么绘制表格呢

解决方案 »

  1.   

    绘制表格==?
     execl 样式的表格还是什么,
      

  2.   

    将邮件的内容格式设置成为html格式
    using System.Net.Mail;
    MailMessage mail = new MailMessage();
    mail.IsBodyHTML = true;然后用
    <table><tr><td/></tr></table>
    画表
      

  3.   

    控制台程序也可以这样画吗?<table><tr><td/></tr></table>
      

  4.   

    可以,邮件可以发送HTML标签,也就可以接受HMTL标签传送,用?<table><tr><td/></tr></table>是可以的
      

  5.   

     /// <summary>
            /// C#发送邮件函数
            /// </summary>
            /// <param name="from">发送者邮箱</param>
            /// <param name="fromer">发送人</param>
            /// <param name="to">接受者邮箱</param>
            /// <param name="toer">收件人</param>
            /// <param name="Subject">主题</param>
            /// <param name="Body">内容</param>
            /// <param name="file">附件</param>
            /// <param name="SMTPHost">smtp服务器</param>
            /// <param name="SMTPuser">邮箱</param>
            /// <param name="SMTPpass">密码</param>        /// <returns></returns>
            public static bool sendmail(string sfrom, string sfromer, string sto, string stoer, string sSubject, string sBody, string sfile, string sSMTPHost, string sSMTPuser, string sSMTPpass)
            {
                ////设置from和to地址
                MailAddress from = new MailAddress(sfrom, sfromer);
                MailAddress to = new MailAddress(sto, stoer);            ////创建一个MailMessage对象
                MailMessage oMail = new MailMessage(from, to);            //// 添加附件
                if (sfile != "")
                {
                    oMail.Attachments.Add(new Attachment(sfile));
                }            ////邮件标题
                oMail.Subject = sSubject;
                            ////邮件内容
                oMail.Body = sBody;
           
                ////邮件格式
                oMail.IsBodyHtml = true;            ////邮件采用的编码
                oMail.BodyEncoding = System.Text.Encoding.GetEncoding("GB2312");            ////设置邮件的优先级为高
                oMail.Priority = MailPriority.High;            ////发送邮件
                SmtpClient client = new SmtpClient();
                ////client.UseDefaultCredentials = false; 
                client.Host = sSMTPHost;
                client.Credentials = new NetworkCredential(sSMTPuser, sSMTPpass);
                client.DeliveryMethod = SmtpDeliveryMethod.Network;
                try
                {
                    client.Send(oMail);
                    return true;
                }
                catch (Exception err)
                {                Console.WriteLine(err.Message.ToString());
                    return false;
                }
                finally
                {
                    ////释放资源
                    oMail.Dispose();
                }        }   body += "<table><tr><td>值</td></tr></table>";//类容
    这样?
      

  6.   

    <table><tr><td/></tr></table>
    写在什么地方 在哪里写 格式怎么写
      

  7.   


     oMail.Body = sBody;
      

  8.   

    MailMessage.IsBodyHTML设置成True就可以了。至于画表格,可以用其它工具画,想vs2010, word什么的。然后存成html作为模板.需要填入数据的地方用占位符,像{$Subject}  {$Product}什么的。发邮件的时候,读取模板,然后用String.Replace("{$Product}","实际内容") 进行替换。再赋给MailMessage.Body 就可以了。