日期:2014-05-20  浏览次数:21028 次

请问怎样才能把带DataGrid里的数据页发送的客户的E_mail中呀?
代码如下:
MailMessage   MailObj=new   MailMessage   ();
try
{
MailObj.From   = "tflb1@163.com ";
MailObj.To   = "tf_lb@163.com ";                                                        
MailObj.Priority   =MailPriority.Normal   ;                                                
MailObj.Subject   = "213 ";
string   Body     =   <html> <body   topmargin=0   leftmargin=0> <b> sdfsdf </b> <iframe   width=100%   height=100%   frameborder= 'no '   src= 'http://www.sohu.com '> </iframe </body> </html> "
Body   =   System.Web.HttpContext.Current.Server.HtmlDecode(Body);//将字符串转换成html
MailObj.BodyFormat   =MailFormat.Html;//将邮件的格式设成mail
//上面的二个语句一个都不能小,否则不能以html的格式发送邮件
MailObj.Body=Body;
//设置支持服务器验证
MailObj.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ",   "1 ");
//设置用户名
MailObj.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername ",   "tflb1 ");
//设置用户密码
MailObj.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword ",   "*** ");
SmtpMail.SmtpServer   =   "smtp.163.com ";                
SmtpMail.Send(MailObj);

}
catch   (Exception   ex)
{
Response.Write( " <script> alert( '错误! ') </script> ");
}

以上代码测试能发Html邮件.但我想发一个带有DataGrid数据页发给客户,并在客户的收件箱内直接可以看到数据,我的想法是把整个DataGrid数据页放到 <iframe> 里,但这样做不成功,以上代码能显示 <b> sdfsdf </b> 这部分,但不能显示 <iframe> 里的页面,请指点一下.这种方式能行吗?或者还有别的方法吗?
我一开始用的是jmail但它直接就是乱码,研究了好久都没解决,所以不要提它了.再有已经测试过好几种邮箱了,都不能显示.
十分感谢...

------解决方案--------------------
可能是邮件客户端为了安全,将HTML代码进行过滤了,不允许显示 <iframe> 中的内容。