发送邮件错误.未能访问“CDO.Message”对象
错误是:
System.Web.HttpException: 未能访问“CDO.Message”对象。 ---> System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.Runtime.InteropServices.COMException (0x80040211): 邮件无法发送到 SMTP 服务器。传输错误代码为 0x80040217。服务器响应为 not available --- 内部异常堆栈跟踪的结尾 --- 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.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) --- 内部异常堆栈跟踪的结尾 --- at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at woo.WebForm1.Page_Load(Object sender, EventArgs e) in e:\wo\woo\webform1.aspx.cs:line 42
------解决方案--------------------如果不是权限问题的话试一试把SmtpServer的属性改用SmtpServer.Insert()方法:
SmtpMail.SmtpServer = "127.0.0.1 "
try
SmtpMail.SmtpServer.Insert( 0, "127.0.0.1 or your mail server name here ")
------解决方案--------------------没有获得权限
SmtpMail.SmtpServer.Insert( 0, "127.0.0.1 or your mail server name here ")