运行时出现错误:
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
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
2.NTFS_12de928e01c41bfd00000003.EML.STL 3.NTFS_12de928e01c41bfd00000003.EML.STM
请问这些文件有什么用? 我该怎么把它们发出去?
mailMessage.SmtpServer="xx.xx.xx.xx"
mailMessage.Send("[email protected]","[email protected]","Hello","Hello,It's success")
其次,你的邮件已经发出去了,至少是程序方面没有问题,
这是你软件设置的问题,SMTP的设置,网络环境等原因造成的,因为你要发的邮件已经到了你的邮件列对了,没有发出去原因比较复杂!如果你是拨号上网,应该可以发的出去,你有IP,
如果你是内网,可能发不出去,网关没有设置路由!如果你拥有对外的IP或直接外网映射到你的电脑!恭喜你可以发出去
IIS里设置STMP允许中续,允许匿名,如果有主机,也是要设中续.应该可以发出去,问题已经超过程序范围了!闪人了!
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()
设置为主机的ip地址192.168.0.1。看看我还有什么没设置的吗??2.在主机服务器上有真实的ip地址,是不是就可以发了。有什么要配置的吗?
我不填的话,我用我们公司内网向内网发邮件,收不到,向里面写了IP就可以收到。
我就是公网上怎么也收不到。
例如我用[email protected]向[email protected]发,就是收不到啊?请问SmtpServer要设置吗?如果要设置才行的话,那我如果用的是别的SMTP那不就是不能发了吗?
允许中续的设置方法是"在中续项中,仅以以下表除外,表你什么不填",程序里
那个server="192.168.0.1";问题关键是主机,还有一个重要的问题,如果有防火墙,请把主机的25端口打开,否则被拦截