这个是我的邮件发送代码,单调出来测试收发正常,但是放到网站里面就不好用了,我是。net的网站,放进去以后就出个错误
private void SendEmail()
{
System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
mail.From = "[email protected]"; string mailto = email;
mail.To = mailto;
mail.Subject = "娉板痉浜烘墠缃戙€€瀵嗙爜鎵惧洖";
mail.BodyFormat = System.Web.Mail.MailFormat.Text;
mail.Body = "鎮ㄧ殑瀵嗙爜宸茬粡琚慨鏀逛负 " + password + " 璇风墷璁?"; //System.Web.Mail.SmtpMail.SmtpServer = "mail.taderhr.com"; //mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", " 32000");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "service");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "taderhr"); System.Web.Mail.SmtpMail.SmtpServer = "mail.taderhr.com"; System.Web.Mail.SmtpMail.Send(mail);
Response.Write("<script>瀵嗙爜宸插埌鎮ㄧ殑閭锛岃娉ㄦ剰鏌ユ敹锛?/script>"); }
解决方案 »
- 日期处理(日程安排)-在固定日期段里剔除节假日等最终生成一个日期周次安排
- HttpContext.Current.Items是什么?session, cache, application, request?
- 请教如何在.cs文件中设置这样的模板(ItemTemplate)
- 在asp.net网页中如何让标题图片自动随网页大小伸缩??
- 新建了一个Web项目,IDE自动创建了.aspx文件,确无法创建.aspx.cs文件
- 新手简单问题:)散点分
- Microsoft Visual Studio .NET 2003的问题
- 请教高手关于ADO.net问题
- 如何在linux环境下发布ASP.NET 2.O网站?
- 如何datagrid生成的表格,鼠标移动到哪行就有不同的背景色???
- 这个SQL异常真让我郁闷
- 怎么把当前网站的所有.aspx动态网页转换成.html静态网页进行浏览
--------------------------------------------------------------------------------邮件无法发送到 SMTP 服务器。传输错误代码为 0x800ccc15。服务器响应为 not available说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Runtime.InteropServices.COMException: 邮件无法发送到 SMTP 服务器。传输错误代码为 0x800ccc15。服务器响应为 not available
源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪:
[COMException (0x80040211): 邮件无法发送到 SMTP 服务器。传输错误代码为 0x800ccc15。服务器响应为 not available
][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 bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) +436
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +72[HttpException (0x80004005): 邮件无法发送到 SMTP 服务器。传输错误代码为 0x800ccc15。服务器响应为 not available
]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +119
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1955
System.Web.Mail.SmtpMail.Send(MailMessage message) +131
Personal_RegUserInformations_GetBackPassword.SendEmail() +187
Personal_RegUserInformations_GetBackPassword.ImageButton2_Click(Object sender, ImageClickEventArgs e) +558
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +86
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +115
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433