使用SmtpMail.Send方法发生错误,怎么办?
我使用SmtpMail.Send(String, String, String, String)执行发送邮件,页面提示: “SendUsing”配置值无效。是什么原因,该如何配置?谢谢!
页面如下:
“/BookShop2003”应用程序中的服务器错误。
--------------------------------------------------------------------------------
“SendUsing”配置值无效。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Runtime.InteropServices.COMException: “SendUsing”配置值无效。
源错误:
行 83: private void Button1_Click(object sender, System.EventArgs e)
行 84: {
行 85: System.Web.Mail.SmtpMail.Send(this.txb1.Text,this.txb2.Text,this.txb3.Text,this.txb4.Text);
行 86: }
行 87:
源文件: c:\inetpub\wwwroot\bookshop2003\webform2.aspx.cs 行: 85
堆栈跟踪:
[COMException (0x80040220): “SendUsing”配置值无效。
]
[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) +1512
System.Web.Mail.SmtpMail.Send(String from, String to, String subject, String messageText) +125
BookShop2003.WebForm2.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\bookshop2003\webform2.aspx.cs:85
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1263
--------------------------------------------------------------------------------
版本信息: Microsoft .NET 框架版本:1.0.3705.0; ASP.NET 版本:1.0.3705.0