运行时出现错误:
System.Web.HttpException: Could not access 'CDO.Message' object. ---> 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80029C4A): Error loading type library/DLL. --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) at System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propKey, Object propValue) at System.Web.Mail.LateBoundAccessHelper.SetProp(Object obj, String propName, Object propKey, Object propValue) --- End of inner exception stack trace --- at System.Web.Mail.LateBoundAccessHelper.SetProp(Object obj, String propName, Object propKey, Object propValue) at System.Web.Mail.CdoSysHelper.SetField(Object m, String name, String value) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at emailsent.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\emailsent\webform1.aspx.cs:line 34 

解决方案 »

  1.   

    再次请教!!!在C:\Inetpub\mailroot\Queue目录下产生三个文件1.NTFS_12de928e01c41bfd00000003.EML
    2.NTFS_12de928e01c41bfd00000003.EML.STL 3.NTFS_12de928e01c41bfd00000003.EML.STM
    请问这些文件有什么用? 我该怎么把它们发出去?
      

  2.   

    dim mailMessage as SmtpMail
    mailMessage.SmtpServer="xx.xx.xx.xx"
    mailMessage.Send("[email protected]","[email protected]","Hello","Hello,It's success")
      

  3.   

    首先SmtpMail.SmtpServer ="";可以去掉或注释掉!
    其次,你的邮件已经发出去了,至少是程序方面没有问题,
    这是你软件设置的问题,SMTP的设置,网络环境等原因造成的,因为你要发的邮件已经到了你的邮件列对了,没有发出去原因比较复杂!如果你是拨号上网,应该可以发的出去,你有IP,
    如果你是内网,可能发不出去,网关没有设置路由!如果你拥有对外的IP或直接外网映射到你的电脑!恭喜你可以发出去
    IIS里设置STMP允许中续,允许匿名,如果有主机,也是要设中续.应该可以发出去,问题已经超过程序范围了!闪人了!
      

  4.   

    仅供参考:Try
                    Dim objMsg As CDO.Message = New CDO.Message()
                    Dim objConfig As CDO.Configuration = objMsg.Configuration
                    Dim objFields As ADODB.Fields = objConfig.Fields                ' Setup server information 
                    objFields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value = _SmtpServer
                    objFields("http://schemas.microsoft.com/cdo/configuration/smtpserverport").Value = _SmtpServerPort
                    objFields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value = 2                ' Setup server login information if your server require it 
                    objFields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate").Value = 1
                    objFields("http://schemas.microsoft.com/cdo/configuration/sendusername").Value = _SendUserName
                    objFields("http://schemas.microsoft.com/cdo/configuration/sendpassword").Value = _SendPassword                objFields.Update()                ' Now you can setup message to send
                    Select Case _BodyFormat
                        Case MailFormat.Html
                            objMsg.HTMLBody = _Body
                            objMsg.HTMLBodyPart.Charset = _BodyEncoding
                        Case MailFormat.Text
                            objMsg.TextBody = _Body
                            objMsg.TextBodyPart.Charset = _BodyEncoding
                    End Select               
                    If _Attachment <> "" Then
                        objMsg.AddAttachment(_Attachment)
                    End If                objMsg.To = _To
                    objMsg.From = _From
                    objMsg.Subject = _Subject                objMsg.Send()
      

  5.   

    强烈赞同bomb_boy(梦之星) !
      

  6.   

    谢谢指教!我是内网的,就是主机一块网卡连ADSL拨号,另一块网卡接集线器,我们通过连集线器共享上网的。主机每次上网的ip都不同,不过用花生壳注注册了域名。请问:1.在内网的机上该怎么设置,SMTP的设置我都试完了,发不出去。我的网关
    设置为主机的ip地址192.168.0.1。看看我还有什么没设置的吗??2.在主机服务器上有真实的ip地址,是不是就可以发了。有什么要配置的吗?
      

  7.   

    大家 好! 我的问题已经基本完成解决了,就是在主机上发才可以,可能是要真实的IP地址吧!!??但是sina的邮箱就可以收,163的邮箱就不可以收,为什么呢????
      

  8.   

    请问上面的程序有个SmtpMail.SmtpServer ="";这句代码,这里为空吗?
    我不填的话,我用我们公司内网向内网发邮件,收不到,向里面写了IP就可以收到。
    我就是公网上怎么也收不到。
    例如我用[email protected][email protected]发,就是收不到啊?请问SmtpServer要设置吗?如果要设置才行的话,那我如果用的是别的SMTP那不就是不能发了吗?
      

  9.   

    发送者 bomb_boy:你把服务器的SMTP设置位允许中续,然后发信的服务器IP就是你内网服务器IP
    允许中续的设置方法是"在中续项中,仅以以下表除外,表你什么不填",程序里
    那个server="192.168.0.1";问题关键是主机,还有一个重要的问题,如果有防火墙,请把主机的25端口打开,否则被拦截