救命啊,邮件发不出去,哪位大人来帮帮我啊!!!
<%@ Page language="c#"%>
<%@ Import Namespace="System.Web.Mail"%>
程序代码:
<script language=C# runat=server>邮件发送失败:System.Web.HttpException: 未能访问“CDO.Message”对象。 ---> System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.Runtime.InteropServices.COMException (0x8004020F): 服务器拒绝了一个或多个收件人地址。服务器响应为: 550 5.7.1 Unable to relay for yinzhoufeng1983@163.com --- 内部异常堆栈跟踪的结尾 --- 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.CdoSysHelper.Send(String from, String to, String subject, String messageText) at System.Web.Mail.SmtpMail.Send(String from, String to, String subject, String messageText) at ASP.WebForm1_aspx.Mail_Send(Object src, EventArgs e) in C:\Inetpub\wwwroot\sendmail\WebForm1.aspx:line 54
public void Mail_Send(Object src,EventArgs e) { string strFrom =tbFrom.Text; string strTo=tbTo.Text; string strSubject=tbSubject.Text; string strMsgText=tbMsgText.Text; try { SmtpMail.SmtpServer = \"127.0.0.1\"; SmtpMail.Send(strFrom,strTo,strSubject,strMsgText); tbTo.Text=\"\"; tbFrom.Text=\"\"; tbSubject.Text=\"\"; tbMsgText.Text=\"\"; lblShowMsg.Text=\"发送至\"+strTo+\"邮件,发送成功\"; } catch(Exception ee) { lblShowMsg.Text=\"邮件发送失败:\"+ee.ToString(); } }
</script>