[COMException (0x80040213): 与服务器的传输连接失败。 
] [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) +112 
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1859 
System.Web.Mail.SmtpMail.Send(MailMessage message) +150 
HSE.Modules.PersonWork.mail.Button1_Click(Object sender, EventArgs e) +210 
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() +1292 
上面是执行出现的错误 
下面是代码 System.Web.Mail.MailMessage msg=new System.Web.Mail.MailMessage(); 
msg.BodyEncoding=System.Text.Encoding.GetEncoding("gb2312"); 
msg.BodyFormat=MailFormat.Text; 
msg.From="[email protected]"; 
msg.Subject="测试程序"; 
msg.To="[email protected]"; 
msg.Body="hello,world!"; 
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication 
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "liujt119"); //set your username here 
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "111555"); //set your password here SmtpMail.SmtpServer = "smtp.mail.yahoo.com"; 
System.Web.Mail.SmtpMail.Send(msg);