CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  ASP.NET

在线发邮件.有问提!求就 我是哪里配置错了?

楼主chenxianping1979()2004-09-04 20:42:20 在 .NET技术 / ASP.NET 提问

下面的带码有问提吗?]  
    <%@   Page   Language="C#"   Debug="true"   %>  
  <%@   Import   Namespace="System.Web.Mail"   %>  
  <script   language="c#"   runat="server">  
  void   sendMailTest()  
  {  
    int[]   array=new   int[9];  
      for(int   intCounter=0;intCounter<=9;intCounter++)  
      {  
      array[intCounter]=intCounter;  
      Response.Write("The   value   of   the   counter   is:"+intCounter+"<br>");  
      }  
  }  
  void   Page_Error(object   sender,EventArgs   e)  
  {  
    string   errorMessage="Error   occurred"+Server.GetLastError();  
    Server.ClearError();  
     
    MailMessage   newMail=new   MailMessage();  
    newMail.From="chenxianping@sohu.com";  
    newMail.To="chenxianping@sohu.com";  
    newMail.Subject="Error   Occurred";  
    newMail.Body=errorMessage;  
    SmtpMail.Send(newMail);  
  }  
  </script>  
  <%  
  sendMailTest();  
  %>  
  <html>  
  <head>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <title>无标题文档</title>  
  </head>  
  <body>  
   
  </body>  
  </html>  
  但结果却不正却.提示如下:  
   
  “/”应用程序中的服务器错误。  
  --------------------------------------------------------------------------------  
   
  与服务器的传输连接失败。    
  说明:   执行当前   Web   请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。    
   
  异常详细信息:   System.Runtime.InteropServices.COMException:   与服务器的传输连接失败。    
   
  源错误:    
   
   
  行   21:     newMail.Subject="Error   Occurred";  
  行   22:     newMail.Body=errorMessage;  
  行   23:     SmtpMail.Send(newMail);  
  行   24:   }  
  行   25:   </script>  
     
   
  源文件:   D:\ASPNETTEMP\index.aspx         行:   23    
   
  堆栈跟踪:    
   
   
  [COMException   (0x80040213):   与服务器的传输连接失败。  
  ]  
   
  [TargetInvocationException:   调用的目标发生了异常。]  
        System.RuntimeType.InvokeDispMethod(String   name,   BindingFlags   invokeAttr,   Object   target,   Object[]   args,   Boolean[]   byrefModifiers,   Int32   culture,   String[]   namedParameters)   +0  
        System.RuntimeType.InvokeMember(String   name,   BindingFlags   invokeAttr,   Binder   binder,   Object   target,   Object[]   args,   ParameterModifier[]   modifiers,   CultureInfo   culture,   String[]   namedParameters)   +473  
        System.Web.Mail.LateBoundAccessHelper.CallMethod(Object   obj,   String   methodName,   Object[]   args)   +58  
   
  [HttpException   (0x80004005):   未能访问“CDO.Message”对象。]  
        System.Web.Mail.LateBoundAccessHelper.CallMethod(Object   obj,   String   methodName,   Object[]   args)   +113  
        System.Web.Mail.CdoSysHelper.Send(MailMessage   message)   +1840  
        System.Web.Mail.SmtpMail.Send(MailMessage   message)   +153  
        ASP.index_aspx.Page_Error(Object   sender,   EventArgs   e)   in   D:\ASPNETTEMP\index.aspx:23  
        System.Web.UI.TemplateControl.OnError(EventArgs   e)   +109  
        System.Web.UI.Page.HandleError(Exception   e)   +68  
        System.Web.UI.Page.ProcessRequestMain()   +2094  
        System.Web.UI.Page.ProcessRequest()   +218  
        System.Web.UI.Page.ProcessRequest(HttpContext   context)   +18  
        System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()   +179  
        System.Web.HttpApplication.ExecuteStep(IExecutionStep   step,   Boolean&   completedSynchronously)   +87  
   
     
  用原码也是同样的结果.我是哪里配置错了? 问题点数:0、回复次数:4Top

1 楼jasonlee0927(一颗心忘了收...)回复于 2004-09-04 20:59:23 得分 0

http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=5138  
  應該對妳有幫助!Top

2 楼lovely_swallow(蓝色夏威夷)回复于 2004-09-04 21:07:34 得分 0

可能是验证没通过吧,试试这样呢:  
  private   void   Page_Load(object   sender,   System.EventArgs   e)    
  {    
  MailMessage   mail   =   new   MailMessage();    
  mail.To   =   "me@mycompany.com";    
  mail.From   =   "you@yourcompany.com";    
  mail.Subject   =   "this   is   a   test   email.";    
  mail.Body   =   "Some   text   goes   here";    
  mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",   "1");   //basic   authentication    
  mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",   "my_username_here");   //set   your   username   here    
  mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",   "super_secret");   //set   your   password   here    
   
  SmtpMail.SmtpServer   =   "mail.mycompany.com";   //your   real   server   goes   here    
  SmtpMail.Send(   mail   );    
  }    
  Top

3 楼chenxianping1979()回复于 2004-09-04 21:26:11 得分 0

都不好使.Top

4 楼lovely_swallow(蓝色夏威夷)回复于 2004-09-04 22:00:14 得分 0

错误信息?Top

相关问题

  • JavaMail发送邮件。在邮件服务器上需要配置吗?在线等
  • 在线等:如何配置才可以使用Domino收发外部邮件,具体如何配置
  • 哪位有实现阻止垃圾邮件的配置文档?在线等
  • ASP.NET发邮件程序“SendUsing”配置值无效错误,请各位指点
  • SQL邮件配置总不成功!!!
  • 配置邮件服务中的问题?
  • domino邮件服务器配置
  • Exchange邮件服务器配置问题
  • 配置错误 ???
  • 配置错误

关键词

得分解答快速导航

  • 帖主:chenxianping1979

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo