try
{
         conn.Open ();
         cmd.ExecuteNonQuery ();
                      
         Session["userID"]=this.txtRegUserName.Text ;

MailMessage sendmail = new MailMessage();
sendmail.To = this.txtEmail.Text.ToString();
sendmail.From = "[email protected]";
sendmail.Subject = "密码找回";
string MailText = "尊敬的cacool用户,您好!";
MailText+="\n这是系统发出的你的用户帐号:";
MailText+="\n\n用户名:"+Session["userID"].ToString();
MailText+="\n密码:"+password;
sendmail.Body=MailText;
SmtpMail.Send(sendmail);
Response.Write("<script language='javascript'> alert('恭喜您注册成功!请登录!');window.location.href='index.aspx'; </script>");

}
catch(System.Exception ex)
{
throw new Exception (ex.Message );
}
finally
{
          conn.Close ();
}程序运行后显示:未能访问“CDO.Message”对象。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Exception: 未能访问“CDO.Message”对象。源错误: 
行 170: catch(System.Exception ex)
行 171: {
行 172: throw new Exception (ex.Message );
行 173: }
行 174: finally
 
这是什么问题,请大家帮忙看看

解决方案 »

  1.   

    MSDN上有几种解决方案,巨麻烦。指定你的SmtpMail.SMTPServer 试一试。
      

  2.   

    private void Page_Load(object sender, System.EventArgs e) 

    MailMessage mail = new MailMessage(); 
    mail.To = "[email protected]"; 
    mail.From = "[email protected]"; 
    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", "user"); //set your username here 
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); //set your password here SmtpMail.SmtpServer = "mail.163.com"; //your real server goes here 
    SmtpMail.Send( mail ); 

    程序运行一直没有反应,怎么回事呢?