首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

GridView1数据导出邮件发送解决方案

2012-03-22 
GridView1数据导出邮件发送GridView1数据导出邮件发送为什么只能发送一条数据?GridView里面有两条以上的数

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 ; 

热点排行