日期:2014-05-18  浏览次数:20796 次

GridView1数据导出邮件发送
GridView1数据导出邮件发送为什么只能发送一条数据?
GridView里面有两条以上的数据
张三 身份证 12232435464 男
李四 身份证 12232435464 男
[code=C#][/code] for (int i = 0; i < intCount; i++)
  {
  Uname = (this.GridView1.Rows[i].FindControl("lblName") as Label).Text;
  UCidtype = (this.GridView1.Rows[i].FindControl("lblCardType") as Label).Text;
  UCid = (this.GridView1.Rows[i].FindControl("lblCid") as Label).Text;
  Utype = (this.GridView1.Rows[i].FindControl("lblCustType") as Label).Text;
  Emailfo = " " + Uname + " " + UCidtype + " " + UCid + " " + Utype +"<br>";
  }
Email.Body = Emailfo ;

发送只收到
李四 身份证 12232435464 男
应该怎么处理才能让两条或多条都收到呢??

------解决方案--------------------
没看明白,发邮件要不循环发,要不两人一起发(用抄送方式)
------解决方案--------------------
你只给MailMessage 的body属性赋值,即有内容,但没有To,你一个人是怎么发出去的?
for (int i = 0; i < intCount; i++)
{
Uname = (this.GridView1.Rows[i].FindControl("lblName") as Label).Text;
Email.To.Add(Uname );
UCidtype = (this.GridView1.Rows[i].FindControl("lblCardType") as Label).Text;
UCid = (this.GridView1.Rows[i].FindControl("lblCid") as Label).Text;
Utype = (this.GridView1.Rows[i].FindControl("lblCustType") as Label).Text;
Emailfo = " " + Uname + " " + UCidtype + " " + UCid + " " + Utype +" <br>";
}
Email.Body = Emailfo ;